It's not a secret anymore!
The moose likes Swing / AWT / SWT and the fly likes button size and frame border Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "button size and frame border" Watch "button size and frame border" New topic

button size and frame border

William Cowie

Joined: Apr 26, 2006
Posts: 1
I am a complete noob with java so bear with me, anyway I have created a simple calculator in the windows style(well that is the idea), I am trying to change the blank button in my code to the same size as the memory buttons down the left hand side but it just stretches. Also I am trying to create a small border round the number, operator and text panels any ideas how to sort these?

heres a pic:

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46429
Welcome to the Ranch.

Of course it stretches. Java Layout Managers are designed that when the size of the whole window changes, the individual components change too.

Go to Cay Horstmann's website, and find the GBC class, then use it to help with the GridBagLayout, which allows you to put an Inset around a button.

You can miss out the line about import java.lang.*; .
Also if you use J2SE 5.0 you can forget about pane and just add() all the components directly.
I agree. Here's the link:
subject: button size and frame border
It's not a secret anymore!