I need to have the text box in first row and underneath that two panels that are next to each other. With the code below, I keep getting each panel underneath each other. How do I get two rows so that in first row, I have the text box and the second row, two panels next to each other? Manfred helped a little with this, but not completely. Thanks for your help....
Hi Brian, If you want a different number of items on each row then you must either use GridBagLayout or make use of more than one GridLayout. For example: place your p2 and p3 into a 1 row, 2 column GridLayout: Panel p4 = new Panel( new GridLayout(1,0) ); p4.add( p2 ); p4.add( p3 ); Then use top panel having 1 column to place them: add( p1 ); // First row add( p4 ); // Second row If you want to play with borders and insets then you need to go ahead and use GridBagLayout. Good Luck, Manfred.
Joined: Feb 03, 2001
Thanks Manfred. That was a big help. Sometimes things seem so obvious after some help. Many thanks.
i feel u may change ur layout,like gridBagLayout or make the freme's layout as null.u can use setBounds() method after setting it to null.
Joined: Jan 09, 2001
Hi Jinu, You should only use the null layout as a last resort! It doesn't provide any functionality for layout changes (i.e., window being resized). As a UI developer, I would be dead set against EVER using null layout. If you don't want to learn the layouts then you shouldn't be using Java to develop apps ... just my opinion. Regards, Manfred.