Author
how to align it??urgent..
kahkean chor
Ranch Hand
Joined: Jan 26, 2013
Posts: 41
can someone help me to solve this problem? i dont want this 2 panel to be balance(the jtextarea and jtextfield should be longer,don't wan it to be balance same as the jlist and jbutton).....but except gridlayout i gt no idea to set it .
this is my code,
JPanel jp1 = new JPanel ();
JPanel jp2 = new JPanel ();
JLabel jblInfo = new JLabel ("User Name :");
String [] members = {"Raymond","Alex","Kelvin"};
JList listMember = new JList (members);
JTextArea lobby = new JTextArea ();
JTextField input = new JTextField ();
JButton send = new JButton ("Send");
public void init() {
jp1.setLayout(new GridLayout (1,2,5,5));
jp1.add(lobby);
jp1.add(listMember);
jp2.setLayout(new GridLayout (1,2,5,5));
jp2.add(input);
jp2.add(send);
add(jblInfo,BorderLayout.NORTH);
add(jp1,BorderLayout.CENTER);
add(jp2,BorderLayout.SOUTH);
setSize(450,350);
}
fail.jpg
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted Feb 20, 2013 23:49:22
0
no idea how you want it to look, but this is a different way of doing it
kahkean chor
Ranch Hand
Joined: Jan 26, 2013
Posts: 41
thanks for your code...it look nice but i hope to enhance it abit
How to increase the height of jlist and how to make the jbutton to the bottom(parallel with jtextfield)
Untitled.jpg
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted Feb 21, 2013 01:36:13
0
don't use the holdingPanel.
add jp2 directly to the frame/applet
at BorderLayout.EAST
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32708
Our vocabulary does not include the word “urgent”.
subject: how to align it??urgent..