• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JButton -> Size

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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�
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Marcus,

Thanks a lot! It works fine!

Regards,
Andr�!
 
The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic