I programmed a screen where it supposed to show different labels, text areas, buttons, etc, and it compiles with no errors but when I run the program the command prompt shows a lot of exceptions I can't figure out why its there, and my window isn't showing up... here's my code thanks
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@1c843d62,flags=296,maximumSize=,minimumSize=,pre
ferredSize=,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],selection
Color=javax.swing.plaf.ColorUIResource[r=184,g=207,b=229],columns=0,columnWidth=0,command=,horizontalAlignment=LEADING] is not attached to a vertical group
at javax.swing.GroupLayout.checkComponents(GroupLayout.java:1090)
at javax.swing.GroupLayout.prepare(GroupLayout.java:1040)
at javax.swing.GroupLayout.preferredLayoutSize(GroupLayout.java:878)
at java.awt.Container.preferredSize(Container.java:1788)
at java.awt.Container.getPreferredSize(Container.java:1773)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1662)
at javax.swing.JRootPane$RootLayout.preferredLayoutSize(JRootPane.java:917)
at java.awt.Container.preferredSize(Container.java:1788)
at java.awt.Container.getPreferredSize(Container.java:1773)
at javax.swing.JComponent.getPreferredSize(JComponent.java:1662)
at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java:719)
at java.awt.Container.preferredSize(Container.java:1788)
at java.awt.Container.getPreferredSize(Container.java:1773)
at java.awt.Window.pack(Window.java:809)
at EncMain.<init>(EncMain.java:73)
at EncMain.main(EncMain.java:102)
JLabel label1 = new JLabel();
JLabel label2 = new JLabel();
JButton button1 = new JButton();
JTextField text1 = new JTextField();
JComboBox box1 = new JComboBox();
you should change that last in:
Code:
this.label1 = new JLabel();
this.label2 = new JLabel();
this.button1 = new JButton();
this.field1 = new JTextField();
this.box1 = new JComboBox();
Bookmarks