This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes buttons are too big Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "buttons are too big" Watch "buttons are too big" New topic
Author

buttons are too big

Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

i am just starting a new project: the GUI part.
the frame is set for the same size as wordpad.
i have a panel that goes in North.
i gave it a flow layout.
it contains 2 JComboBox and 7 buttons.
it looked ok till i added the icons to the buttons.
the buttons are now too big.
can i make them the same size as the icons they display?
can i just make them smaller?
so they fit.

i tried setSize(int, int)
it didn't do anything.


SCJP
Visit my download page
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4990
    
    8

setMargin(...)


luck, db
There are no new questions, but there may be new answers.
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

that is good to know, but not what i did. i used setPreferredSize(Dimension d)

it is exactly what i wanted. i even have room left over for a print button
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4990
    
    8

That won't suffice for any and every layout.

You want a button without margins, the appropriate approach is to set the margins to [0, 0, 0, 0].
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

ok, it works for flow layout though
on rethinking, i think i will do it your way. it's just as easy
easier even
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: buttons are too big
 
It's not a secret anymore!