Results 1 to 3 of 3
  1. #1
    tomhcole is offline Member
    Join Date
    Sep 2008
    Posts
    1
    Rep Power
    0

    Default Setting a picture on a button

    I am new to java and want to find out the easiest way in java
    on netbeans to set a picture on an "ok button" when the action is peformed?
    any suggestions???

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Easiest way? There's really one main way to do it (that I know of). Place the image in an ImageIcon, and then place the imageicon into the button using the setImageIcon(...) method. You will need to read and study the Sun Swing tutorials JButton section to learn how to do this best.

    Good luck.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Similar Threads

  1. how to import a picture into an applet
    By cecily in forum Java Applets
    Replies: 2
    Last Post: 01-15-2010, 08:51 PM
  2. Replies: 5
    Last Post: 06-06-2008, 09:31 AM
  3. Picture help
    By deathnote11 in forum AWT / Swing
    Replies: 13
    Last Post: 06-03-2008, 05:46 PM
  4. Picture in a JFrame problem
    By saytri in forum New To Java
    Replies: 3
    Last Post: 01-12-2008, 09:44 AM
  5. Print a picture file
    By oli001 in forum New To Java
    Replies: 0
    Last Post: 11-26-2007, 01:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •