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 3 of 3

Thread: Interesing JButton Query

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Interesing JButton Query

    Well i am trying on my project and i have completed it

    But looking it as per GUI application i want to hide the JButton's text and only Image Icon should be visible
    And the interesting clause is that the JButton name should not be NULL or "" it shud be the name that i have entered

    Eg:

    JButton b=new JButton("Button",new ImageIcon("m.png"));

    Now the button should only contain m.png and not the text "Button"


    Help plzz as soon as possible


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Interesing JButton Query

    Not sure I understand, you want to 'name' the button without showing the name? Do you mean you wish to name it for actionCommands? Something like

    JButton b=new JButton(new ImageIcon("m.png"));
    b.setActionCommand("Button");

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Interesing JButton Query

    Thanx got the sol 100% working

Similar Threads

  1. How to Add ActionListener to a JButton in Swing?
    By JavaPF in forum Java Swing Tutorials
    Replies: 17
    Last Post: April 24th, 2013, 05:14 PM
  2. JButton...
    By chronoz13 in forum AWT / Java Swing
    Replies: 1
    Last Post: November 27th, 2009, 11:39 AM
  3. how to make a simple JButton on a JFrame window?
    By chronoz13 in forum AWT / Java Swing
    Replies: 8
    Last Post: November 20th, 2009, 10:08 PM
  4. need help with JButton and switch statements
    By jjoubert in forum AWT / Java Swing
    Replies: 5
    Last Post: October 28th, 2009, 09:13 AM
  5. MSSQL Query Question
    By sravyen in forum JDBC & Databases
    Replies: 1
    Last Post: October 13th, 2009, 02:47 AM