• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with Layout

 
Brian Snyder
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Regards,
Manfred.
 
Brian Snyder
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Thanks!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic