File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 4339
    
    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: 4522
    
    5

setMargin(...)


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

Joined: Oct 21, 2000
Posts: 4339
    
    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: 4522
    
    5

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: 4339
    
    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
 
 
subject: buttons are too big
 
Similar Threads
click ' a picture'
JButton with icon as background and button name as pop up
how to increase the icon size in radioButton
How to add two buttons in each row?
JButton, icons and size.