File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes how to align it??urgent.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to align it??urgent.." Watch "how to align it??urgent.." New topic
Author

how to align it??urgent..

kahkean chor
Ranch Hand

Joined: Jan 26, 2013
Posts: 56
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);
}


[Thumbnail for fail.jpg]

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
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: 56
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)


[Thumbnail for Untitled.jpg]

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
don't use the holdingPanel.
add jp2 directly to the frame/applet
at BorderLayout.EAST
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36507
    
  16
Our vocabulary does not include the word “urgent”.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to align it??urgent..
 
Similar Threads
JTextField not accessable in applet
JTextArea refresh problem
JTextField with arrow listener(up&down).
Problem with GroupLayout Manager
jframe not accepting sql query..