• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to align it??urgent..

 
kahkean chor
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
[Thumbnail for fail.jpg]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no idea how you want it to look, but this is a different way of doing it

 
kahkean chor
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
[Thumbnail for Untitled.jpg]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
don't use the holdingPanel.
add jp2 directly to the frame/applet
at BorderLayout.EAST
 
Campbell Ritchie
Sheriff
Pie
Posts: 49796
69
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic