Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2008
    Posts
    1
    Rep Power
    0

    Default Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException:

    Hi all,
    Iam using GroupLayout to layout components in a JFrame. The frame inturn has three JPanels ( which also use GroupLayout to layout their contents) . When the following code is executed,
    midlePanelLayout.setHorizontalGroup(
    midlePanelLayout.createParallelGroup(GroupLayout.A lignment.LEADING).addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, size1, GroupLayout.PREFERRED_SIZE).addComponent(buttonPan el, GroupLayout.PREFERRED_SIZE, size1, GroupLayout.PREFERRED_SIZE));
    midlePanelLayout.setVerticalGroup(
    midlePanelLayout.createSequentialGroup().addCompon ent(scrollPane, GroupLayout.PREFERRED_SIZE, size2, GroupLayout.PREFERRED_SIZE).addComponent(buttonPan el, GroupLayout.PREFERRED_SIZE, size3, GroupLayout.PREFERRED_SIZE));


    the following exception is thrown :
    Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: javax.swing.JScrollPane[,0,0,0x0,invalid,layout=javax.swing.ScrollPaneLayo ut$UIResource,alignmentX=0.0,alignmentY=0.0,border =javax.swing.plaf.metal.MetalBorders$ScrollPaneBor der@941db6,flags=16777544,maximumSize=,minimumSize =,preferredSize=,columnHeader=,horizontalScrollBar =javax.swing.JScrollPane$ScrollBar[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.Met alScrollBarUI,alignmentX=0.0,alignmentY=0.0,border =,flags=4194632,maximumSize=,minimumSize=,preferre dSize=,blockIncrement=10,orientation=HORIZONTAL,un itIncrement=1],horizontalScrollBarPolicy=HORIZONTAL_SCROLLBAR_AS _NEEDED,lowerLeft=,lowerRight=,rowHeader=,upperLef t=,upperRight=,verticalScrollBar=javax.swing.JScro llPane$ScrollBar[,0,0,0x0,invalid,layout=javax.swing.plaf.metal.Met alScrollBarUI,alignmentX=0.0,alignmentY=0.0,border =,flags=4194632,maximumSize=,minimumSize=,preferre dSize=,blockIncrement=10,orientation=VERTICAL,unit Increment=1],verticalScrollBarPolicy=VERTICAL_SCROLLBAR_AS_NEE DED,viewport=javax.swing.JViewport[,0,0,0x0,invalid,layout=javax.swing.ViewportLayout ,alignmentX=0.0,alignmentY=0.0,border=,flags=25165 832,maximumSize=,minimumSize=,preferredSize=,isVie wSizeSet=false,lastPaintPosition=,scrollUnderway=f alse],viewportBorder=] is not attached to a vertical group
    at javax.swing.GroupLayout.checkComponents(GroupLayou t.java:1069)
    at javax.swing.GroupLayout.prepare(GroupLayout.java:1 019)
    at javax.swing.GroupLayout.minimumLayoutSize(GroupLay out.java:875)
    at java.awt.Container.minimumSize(Container.java:1668 )
    at java.awt.Container.getMinimumSize(Container.java:1 653)
    at javax.swing.JComponent.getMinimumSize(JComponent.j ava:1709)
    at javax.swing.GroupLayout$ComponentSpring.calculateN onlinkedMinimumSize(GroupLayout.java:2933)
    at javax.swing.GroupLayout$ComponentSpring.calculateM inimumSize(GroupLayout.java:2897)
    at javax.swing.GroupLayout$Spring.getMinimumSize(Grou pLayout.java:1315)
    at javax.swing.GroupLayout$Group.getSpringSize(GroupL ayout.java:1602)
    at javax.swing.GroupLayout$Group.calculateSize(GroupL ayout.java:1593)
    at javax.swing.GroupLayout$Group.calculateMinimumSize (GroupLayout.java:1564)
    at javax.swing.GroupLayout$ParallelGroup.calculateMin imumSize(GroupLayout.java:2499)
    at javax.swing.GroupLayout$Spring.getMinimumSize(Grou pLayout.java:1315)
    at javax.swing.GroupLayout$Group.getSpringSize(GroupL ayout.java:1602)
    at javax.swing.GroupLayout$Group.calculateSize(GroupL ayout.java:1588)
    at javax.swing.GroupLayout$Group.calculateMinimumSize (GroupLayout.java:1564)
    at javax.swing.GroupLayout$Spring.getMinimumSize(Grou pLayout.java:1315)
    at javax.swing.GroupLayout.calculateAutopadding(Group Layout.java:1047)
    at javax.swing.GroupLayout.prepare(GroupLayout.java:1 037)
    at javax.swing.GroupLayout.minimumLayoutSize(GroupLay out.java:875)
    at java.awt.Container.minimumSize(Container.java:1668 )
    at java.awt.Container.getMinimumSize(Container.java:1 653)
    at javax.swing.JComponent.getMinimumSize(JComponent.j ava:1709)
    at javax.swing.GroupLayout$ComponentSpring.calculateN onlinkedMinimumSize(GroupLayout.java:2933)
    at javax.swing.GroupLayout$ComponentSpring.calculateM inimumSize(GroupLayout.java:2897)
    at javax.swing.GroupLayout$Spring.getMinimumSize(Grou pLayout.java:1315)
    at javax.swing.GroupLayout$ComponentSpring.calculateP referredSize(GroupLayout.java:2904)
    at javax.swing.GroupLayout$Spring.getPreferredSize(Gr oupLayout.java:1325)
    at javax.swing.GroupLayout$Group.getSpringSize(GroupL ayout.java:1604)
    at javax.swing.GroupLayout$Group.calculateSize(GroupL ayout.java:1588)
    at javax.swing.GroupLayout$Group.calculatePreferredSi ze(GroupLayout.java:1568)
    at javax.swing.GroupLayout$Spring.getPreferredSize(Gr oupLayout.java:1325)
    at javax.swing.GroupLayout$Group.getSpringSize(GroupL ayout.java:1604)
    at javax.swing.GroupLayout$Group.calculateSize(GroupL ayout.java:1588)
    at javax.swing.GroupLayout$Group.calculatePreferredSi ze(GroupLayout.java:1568)
    at javax.swing.GroupLayout$Spring.getPreferredSize(Gr oupLayout.java:1325)
    at javax.swing.GroupLayout$SequentialGroup.setValidSi ze(GroupLayout.java:1972)
    at javax.swing.GroupLayout$Group.setSize(GroupLayout. java:1553)
    at javax.swing.GroupLayout.layoutContainer(GroupLayou t.java:903)
    at java.awt.Container.layout(Container.java:1432)
    at java.awt.Container.doLayout(Container.java:1421)
    at java.awt.Container.validateTree(Container.java:151 9)
    at java.awt.Container.validateTree(Container.java:152 6)
    at java.awt.Container.validateTree(Container.java:152 6)
    at java.awt.Container.validate(Container.java:1491)
    at javax.swing.RepaintManager.validateInvalidComponen ts(RepaintManager.java:635)
    at javax.swing.SystemEventQueueUtilities$ComponentWor kRequest.run(SystemEventQueueUtilities.java:127)
    at java.awt.event.InvocationEvent.dispatch(Invocation Event.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java: 597)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:273)
    at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:183)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:173)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:168)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:160)
    at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:121)

    This is the code for creating the JScrollPane :
    formPanel = new JPanel();
    scrollPane = new JScrollPane(formPanel);
    formPanel.setBackground(new Color(0, 0, 0));
    formPanelLayout = new GroupLayout(formPanel);
    formPanel.setLayout(formPanelLayout);

    Can anybody tell me why the Exception is getting thrown for the GroupLayout ? Any help is greatly appreciated ?

    Thanks
    Satish

  2. #2
    andreea is offline Member
    Join Date
    Dec 2009
    Posts
    1
    Rep Power
    0

    Default

    hello.
    I'm having the exact same problem and it's driving me crazy.
    Do you happen to remember what you did to get rid of it?
    Thanks

  3. #3
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,226
    Rep Power
    6

    Default

    The easiest way to get rid of it is to create the GUI yourself and don't rely on an IDE to generate code that you don't understand.

Similar Threads

  1. Replies: 3
    Last Post: 01-29-2008, 01:37 AM
  2. Replies: 1
    Last Post: 08-06-2007, 06:04 PM
  3. Replies: 1
    Last Post: 08-06-2007, 06:07 AM
  4. Replies: 1
    Last Post: 07-25-2007, 10:55 PM
  5. Replies: 1
    Last Post: 07-16-2007, 06:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •