any ideas?
(please send email also)
thanks
Joel
--
*****************************************************************
Joel Nylund
jny...@ami.net
"Remember, a flute without a hole is not a flute, but a donut
without a hole is a danish"
*****************************************************************
Have a look at the source, for example MetalButtonUI.java
Dino.
The easiest way is to draw your own circular GIF graphic with a transparent
background.
One 'unpressed' and one 'pressed'.
Place the icons onto the button and set the button transparent and remove
the border.
Eg:
JButton button = new JButton( new ImageIcon( ..unpressicon.. ) );
button.setPressedIcon( new ImageIcon( ..pressicon.. ) );
button.setOpaque( false );
button.setBorder( null );
Now your button will appear to look round.
--
Regards,
James Tan
May the force be with you... Always...
--------------------------------------------------
Homepage: http://www.post1.com/home/james.tan
Personal Email: jame...@earthling.net
Office Email: jame...@cls.uob.com.sg
ICQ Number: 2618988
--------------------------------------------------
thanks
Joel
> I wanted to do that, but the problem is that the image icon is one size, for
> different text lengths I need different button sizes, just like normal buttons.
>
> thanks
> Joel
What about creating your own border by extending from AbstractBorder?
You can use graphics object from the paintBorder() method to do your own round
corner rectangle.
Then just set the border of the buttons to your own.
> Joel Nylund wrote:
>
> > I wanted to do that, but the problem is that the image icon is one size, for
> > different text lengths I need different button sizes, just like normal buttons.
> >
> > thanks
> > Joel
>
> What about creating your own border by extending from AbstractBorder?
> You can use graphics object from the paintBorder() method to do your own round
> corner rectangle.
> Then just set the border of the buttons to your own.
>
Just to add on, the problem with this is when you switch between different L&F, you
have a problem.
Assuming you're using Metal L&F the border you've create may look differently from
say Motif L&F.
Also, if Swing decided to change the way their button border looks, you've had it!
Maybe doing your own ButtonUI and sticking to it may solve your problem, as suggested
by Dino.