wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JButton -> Size Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JButton -> Size" Watch "JButton -> Size" New topic
Author

JButton -> Size

Andr� Latour
Greenhorn

Joined: May 22, 2006
Posts: 15
Hello erveryone,

in my opinion it sounds like an easy question, but i don�t find the right answer.
I have a simple undecorated frame, with only one JPanel inside.
This JPanel has three JButtons inside. (GridLayout (3,1))
Each JButton has an image (like a traffic light).

Now i want this JButtons to be as small as possible. Therefore i designed
three very small images (16x16).

How do i get the JButtons as small as the images are? Now, the Buttons do not get smaller when i take smaller images.
The small images are only centered in the JButton that has the same size as before.

Thanks in advance,
Andr�
Marcus Hathaway
Ranch Hand

Joined: Jun 07, 2005
Posts: 89
Hi Andre, i'm after a similar solution.

Bascially i want my image to be the JButton, so that its not simply in the middle of a normal looking button. I've tried various things so far but without joy
Marcus Hathaway
Ranch Hand

Joined: Jun 07, 2005
Posts: 89
Hi Andre,

I solved my problem and maybe it will help you:
Andr� Latour
Greenhorn

Joined: May 22, 2006
Posts: 15
Hello Marcus,

Thanks a lot! It works fine!

Regards,
Andr�!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JButton -> Size
 
Similar Threads
Trouble implementing a GUI
Injection of Dependencies Springs
JButton size mystery
Trouble Aligning JButtons (And setting width)
Creating A 'Create Your Own Adventure' Game In Java