Textfield and label positioning

Hello,

What's the best way to add a JLabel a JTextfield with the correct alignment ?
I want to create a Wizard and add the labeled textfields using the standard way.

I am currently using com.intellij.ui.components.panels.VerticalBox as the form container and adding a JLabel and a JTextField in a JPanel with GridLayout(1,2);
Is there any component ready for usage ? Which Layout are you guys using for a form layout ?

Best Regards,

George Gastaldi

0
2 comments
Avatar
Permanently deleted user

Hi George,

Generally, you can use any layout which does the job. Considering your approach - the problem is that GridLayout splits canvase into equal-sized cells and that might be inapropriate for you.

Alternatives: use IJ ui designer; use FlowLayout or GridBagLayout/MigLayout with proper setup

Denis

0

Hi Dennis,

MigLayout did the job for me, thanks for the suggestion !

Best Regards,

George Gastaldi

0

Please sign in to leave a comment.