Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JButton -> Size

 
Andr� Latour
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andre,

I solved my problem and maybe it will help you:
 
Andr� Latour
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Marcus,

Thanks a lot! It works fine!

Regards,
Andr�!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic