Giving particular shape to JButton

Hello i d like to know if its possible to give any particular shape to a JButton ? Round or Rounded rectangle shape, or shape with different curves ? If yes where to start please, what is the best way to do it ? thanx for information.
[241 byte] By [JusteUneQuestiona] at [2007-11-27 5:41:03]
# 1

Yes its possible to give any particular shape to a JButton, like Round or Rounded rectangle it's quiet easy, you can even give it a shape of polygon with many edges.

Refer to Apress publications, The Definitive Guide To Java Swing, June 2005, 3rd Edition, by John Zukowski. for more details.

I'll try to post an internet link as soon as i find one.

Swing_guya at 2007-7-12 15:18:07 > top of Java-index,Desktop,Core GUI APIs...
# 2

Hello swing_guy, is there limitation in shape that we can give ? I like to make a rounded shape button but not a regular circle. I dont know how to do it, but maybe if its possible to make a shape from other shape, like a round shape and an oval shape added together to give the shape of button i want. Is it possible or is there better straighter way to give shape to a button ? For exemple my button would round with a lump on the top.

I have this book from Apress :) but i didnt find anything for giving particular shape to button, maybe you could tell me what pages or chapter

Thx

JusteUneQuestiona at 2007-7-12 15:18:07 > top of Java-index,Desktop,Core GUI APIs...
# 3

well there is no limitation on what shape you can give to your button, they are only limited by one's visualization and creativity. I'll have to go through google and a few books, to see how complex shapes can be drawn, but i know it can be, i've seen an example recently.

For simple shapes you can implement the javax.swing.border.Border interface. and override the paintBorder(Component c, Graphics g, int x, int y, int width, int height) method to draw the border. This will give you some idea about the process.

Swing_guya at 2007-7-12 15:18:07 > top of Java-index,Desktop,Core GUI APIs...
# 4
I think you will be more than happy after visiting this link http://fivedots.coe.psu.ac.th/~ad/jg/ch045/index.html
Swing_guya at 2007-7-12 15:18:07 > top of Java-index,Desktop,Core GUI APIs...