This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes creating buttons with graphics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "creating buttons with graphics" Watch "creating buttons with graphics" New topic
Author

creating buttons with graphics

Nikos Stavros
Ranch Hand

Joined: Feb 24, 2006
Posts: 243

Hello there, can anyone recommend me how to create a button with an arrow instead of text with the word UP, or DOWN


Jesus lives
Anand Loni
Ranch Hand

Joined: Jan 20, 2006
Posts: 150
u can use ImageIcons for JButtons...


~ Anand,
SCJP 1.5, SCWCD 1.5
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Are you asking how to create the button, or how to create the icon/image?


There is no emoticon for what I am feeling!
Nikos Stavros
Ranch Hand

Joined: Feb 24, 2006
Posts: 243

how to create the image and assign it to the button,
thanks
Anand Loni
Ranch Hand

Joined: Jan 20, 2006
Posts: 150
Hi, here is small code that creates ImageIcon and shows it with text on JButton...


ImageIcon image = new ImageIcon("images/image1.gif");
JButton button = new JButton("Image with Text", image);

the parameter to constructor of ImageIcon is path of gif image and button
will have text "Image with Text" and gif image.
Nikos Stavros
Ranch Hand

Joined: Feb 24, 2006
Posts: 243

cheers thats helpful
 
Consider Paul's rocket mass heater.
 
subject: creating buttons with graphics
 
Similar Threads
How to Uncheck the checkbox
creation of textarea with formatting buttons
Recreating Buttons
what is diff betwn object and instance
how to create a button via J2ME