Click to See Complete Forum and Search --> : JLabels in Swings.


sheela
September 19th, 2000, 01:30 AM
Hi,
How to position the JLabels other than using the left righ& center align. Can we use setBounds in JApplets like in AWT(APPLETS).B'coz in my prg of swings only the textfields & buttons are seen , the labels are not seen. How to place JLabels &JTextFields,JButtons etc in reqd position. Pl. educate how to format the screen in swings in reqd. x,y co-ordinates of our choice.

cpraveenbabu
September 19th, 2000, 01:39 AM
Hi ,
Yes U can use setBounds to position labels.
But its not preferred.U can also use gridbag layout to exactly position components.
If U find that complex,the best way is to add components to Jpanels and use a setPreferredSize method for those panels which will exactly fit the components in the required position.

Eg. labelPanel.setPreferredSize( new Dimension (x,y) );

Hope this will help u.
If u have any more doubt reply to cpraveen78@hotmail.com

Best regards
Praveen.C

When going gets tough,
Tough gets going.