• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

buttons are too big

 
Randall Twede
Ranch Hand
Posts: 4467
3
Java Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setMargin(...)
 
Randall Twede
Ranch Hand
Posts: 4467
3
Java Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5148
11
Java Netbeans IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4467
3
Java Python Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, it works for flow layout though
on rethinking, i think i will do it your way. it's just as easy
easier even
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic