Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Help with Layout

 
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).]
 
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!!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic