jQuery in Action, 3rd edition
The moose likes Swing / AWT / SWT and the fly likes Help with Layout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Help with Layout" Watch "Help with Layout" New topic

Help with Layout

Brian Snyder
Ranch Hand

Joined: Feb 03, 2001
Posts: 142
I'm a newbie trying o create a calculator with the display only on top (p1), and the number keys 0-9 (p2) and operators x,-,+,=,/ in the row below it. I keep getting all three in a row.
There must be an obvious answer, but since I'm gree, I would really appreciate your help.
Thanks in advance....here's the code.

[This message has been edited by Brian Snyder (edited February 17, 2001).]
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Brian,
By default the GridLayout will assume 1 row and n columns. If you want 3 rows then you have to tell it in the GridLayout constructor:
setLayout( new GridLayout( 3,0 ) );
Then your code should work as you expect it to.
Brian Snyder
Ranch Hand

Joined: Feb 03, 2001
Posts: 142
Thanks for the help Manfred.....
What I need is to have the display in the first row and the numbers 0 - 9 and the operator keys in 2 separate panels in the second row.
I agree. Here's the link: http://aspose.com/file-tools
subject: Help with Layout
It's not a secret anymore!