Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: suggestions required on Jlabel(ImageIcon) and Jbutton for mouselistener

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    16
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default suggestions required on Jlabel(ImageIcon) and Jbutton for mouselistener

    well my programme near to end . i am using Jlabels with ImageIcon . but some time when i clicked on outside of jlabel/ImageIcon the mouse event generated un-wantedly on some other label. i heared that ImageIcon in Jlabels are not good for mouselistener because even in my programme sometime events wrongly generate when i clicked on one JLabel ImageIcon which disabled for mouselistener then an active mouselistener jlabel catch that event and activated.

    Please suggest me should i drop the idea for using JLabel with ImageIcon. and use JButtons Instead.

    Your Suggestions and comments will guide me
    Thanks


  2. #2
    Member
    Join Date
    Jul 2013
    Posts
    219
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default Re: suggestions required on Jlabel(ImageIcon) and Jbutton for mouselistener

    Hello.
    I guess JLabel works very well with ImageIcon.
    Can you post your code? Let me see the look-and-feel.

    Syed.

  3. #3
    Junior Member
    Join Date
    Nov 2013
    Posts
    16
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: suggestions required on Jlabel(ImageIcon) and Jbutton for mouselistener

    Well Syed Bhai Thanks for your suggestions but Conceptually, a label is not intended to be interactive (except tooltips or mouseover effects).
    Next I Am thinking of My users. What about those who prefer to use keyboard?
    Buttons have a standard (well implemented) behaviour for different mouse events? (Try to click on it and drag the mouse out, for instance)
    Thus I am going with JButton and ActionListener.

  4. #4
    Member
    Join Date
    Jul 2013
    Posts
    219
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default Re: suggestions required on Jlabel(ImageIcon) and Jbutton for mouselistener

    Hello.
    I did not talk of interaction with JLabels. JLabels are passive components which means users will never interact with them.
    Still, if we want to display an image using JLabel I said its possible with ImageIcon.

    Syed.

Similar Threads

  1. JButton ImageIcon Composed of Multiple Images
    By Destro in forum AWT / Java Swing
    Replies: 5
    Last Post: April 30th, 2012, 11:13 AM
  2. Auto Update JLabel on JButton Press?
    By Java Programmer in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 11th, 2012, 06:55 PM
  3. Creating an Applet program using JTextFields, JLabel, Jbutton.
    By Maxly in forum Java Theory & Questions
    Replies: 1
    Last Post: March 9th, 2012, 02:39 PM
  4. JApplet containing JButton and a JLabel
    By JuneM in forum AWT / Java Swing
    Replies: 3
    Last Post: March 26th, 2010, 08:32 AM
  5. JAVA Image Icon and JButton resizing problem
    By antitru5t in forum AWT / Java Swing
    Replies: 1
    Last Post: March 13th, 2009, 04:39 AM

Tags for this Thread