• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 629
  • Last Modified:

Displaying images as Jbutton

Hi All,

Can someone please suggest how can I make my images to be a button?

I am trying to show just an image and no borders etc. and want it to work as button.

Thanks!
0
hipal
Asked:
hipal
4 Solutions
 
hipalAuthor Commented:
I am not trying to display a picture in JButton but trying to make an image itself a button.
0
 
objectsCommented:
you can use an image as a JButton icon
then you need to remove all extra painting round the edges. Look for a look and feel that supports that (or write your own)
you could also try subclassing and overriding paintComponent()/paint()
0
 
hipalAuthor Commented:
Can you please give a very simple example overriding paintCOmponent to replace a circle as a button.

Hope I am not asking for too much. It that needs too much code, please ignore ..

thank you !
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
ksivananthCommented:
check this for creating round button, http://www.javanb.com/java/2/19561.html
0
 
ValeriCommented:
you can extend AbstractButton and to paint exactly what you need /in other words only the image/
Also you can use the JButton without border and set only image in it. like in this example :
http://www.esus.com/javaindex/j2se/jdk1.2/javaxswing/atomiccontrols/jbutton/jbuttonnoborder.html
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now