View Single Post
  #1 (permalink)  
Old 01-08-2008, 11:20 PM
dim_ath dim_ath is offline
Member
 
Join Date: Jan 2008
Posts: 14
dim_ath is on a distinguished road
what layout to use for vertical alignment?
Hello everyone! i d like your help on the following:
i d like the label, textfield and button (panel) to be appeared the one
under the other and not all in the same line.
what layout manager need to use?
Thanks!


panel=new JPanel();
panel2=new JPanel();
label=new JLabel("Choose a number from 1 to 10:");
enterField = new JTextField(8);
button=new JButton("Send");
enterField.setEnabled( false );

panel.setLayout(new FlowLayout(FlowLayout.CENTER));
panel.add(label);
panel.add(enterField);
panel.add(button);

displayArea = new JTextArea(10,25);
displayArea.setEnabled( false );
scroller = new JScrollPane( displayArea );
panel2.add(scroller);


Container container = getContentPane();
container.add( panel, BorderLayout.NORTH );
container.add( panel2, BorderLayout.SOUTH );

//setSize(400,250);
pack( );
setVisible( true );
Reply With Quote
Sponsored Links