Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ATM--Homework assignment

 
Jeff Myers
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can get the display to show the North, South, Center, and East portions of the display using BorderLayout, but how do I put 3 buttons (stacked vertically) into the East portion and get them to do their required actions when the info is entered into the textfield in the North portion? Also, how do I get the four BorderLayout areas to not come up as buttons? The book that I am using does a lousy job explaining and I am at wits end. Please help!
 
sanjays samadder
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
seems that you have been long waiting for reply.
what you do to get three buttons at the north position is
first get an instance of panel put that to the north.
using the frames default borderlayout.
then assign gridlayout to that panel by
p.setLayout( new GridLayout(3,1));
it creates a grid of 3by 1 then add the three buttons in order
to the panel.
to recieve ActionEvent from this buttons implemet the ActionListener Interface As usuall and Override the actionPerformed method one actionPerformed method will handle all the action for all the button if you have declared them global of as member varilabes as you call them
hpoe this makes it clear.
sanjay
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic