File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: creating buttons with graphics