I get a long list of errors. Can anyone suggest me where I'm wrong, GroupLayout .
layout.setHorizontalGroup( layout.createSequentialGroup() .addComponent(new JLabel("Enter Book Name")) .addComponent(new JTextField("TextField", 20)) );
Mistake:
Exception in thread "main" java.lang.IllegalStateException:
javax.swing.JTextField [, 0,0,0x0, invalid, layout = javax.swing.
plaf.basic.BasicTextUI $ UpdateHandler, alignmentX = 0.0,
alignmentY = 0.0, border = javax.swing.plaf.BorderUIResource $
CompoundBorderUIResource @ 3d0bbf9e, flags = 296, maximumSize =,
minimumSize =, preferredSize =, caretColor = sun.swing.
PrintColorUIResource [r = 51, g = 51, b = 51], disabledTextColor = javax
.swing.plaf.ColorUIResource [r = 184, g = 207, b = 229], editable = true
, margin = javax.swing.plaf.InsetsUIResource [top = 0, left = 0,
bottom = 0, right = 0], selectedTextColor = sun.swing.
PrintColorUIResource [r = 51, g = 51, b = 51], selectionColor = javax.
swing.plaf.ColorUIResource [r = 184, g = 207, b = 229], columns = 20,
columnWidth = 0, command =, horizontalAlignment = LEADING]
is not attached to a vertical group
at javax.swing.GroupLayout.checkComponents (Unknown Source)
at javax.swing.GroupLayout.prepare (Unknown Source)
java layout swing grouplayout
John
source share