dcsimg
BoxLayout can't be shared?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Albert_Leng
Posted On:   Tuesday, January 22, 2002 02:36 PM

I'm trying to create an application which use several layouts. I can compile the application but when i try to run the application, the following message appears. Exception in thread "main" java.awt.AWTError: BoxLayout can't be shared at javax.swing.BoxLayout.checkContainer(BoxLayout.java:359) at javax.swing.BoxLayout.invalidateLayout(BoxLayout.java:152) at java.awt.Container.invalidate(Container.java:701) at java.awt.Component.addNotify(Component.java:4036) at java.awt.Container.addNotify(Container.java:1572) at javax.swing.JComponent.addNotify(JComponent.java:3500) at java.awt.Container.addNotify(Container.java:1579) at javax.swing.JComponent.addNotify(JComponent.java:3500)    More>>

I'm trying to create an application which use several layouts. I can compile the application but when i try to run the application, the following message appears.

Exception in thread "main" java.awt.AWTError: BoxLayout can't be shared
at javax.swing.BoxLayout.checkContainer(BoxLayout.java:359)
at javax.swing.BoxLayout.invalidateLayout(BoxLayout.java:152)
at java.awt.Container.invalidate(Container.java:701)
at java.awt.Component.addNotify(Component.java:4036)
at java.awt.Container.addNotify(Container.java:1572)
at javax.swing.JComponent.addNotify(JComponent.java:3500)
at java.awt.Container.addNotify(Container.java:1579)
at javax.swing.JComponent.addNotify(JComponent.java:3500)
at java.awt.Container.addNotify(Container.java:1579)
at javax.swing.JComponent.addNotify(JComponent.java:3500)
at java.awt.Container.addNotify(Container.java:1579)
at javax.swing.JComponent.addNotify(JComponent.java:3500)
at java.awt.Container.addNotify(Container.java:1579)
at javax.swing.JComponent.addNotify(JComponent.java:3500)
at java.awt.Container.addNotify(Container.java:1579)
at javax.swing.JComponent.addNotify(JComponent.java:3500)
at javax.swing.JRootPane.addNotify(JRootPane.java:483)
at java.awt.Container.addNotify(Container.java:1579)
at java.awt.Window.addNotify(Window.java:351)
at java.awt.Frame.addNotify(Frame.java:361)
at java.awt.Window.pack(Window.java:369)
at LightbarBuilder.main(lightbarBuilder.java:284)

Does anybody have any idea what happens? How can i solve this problem?


Please use html tags to format code blocks.

   <<Less

Re: BoxLayout can't be shared?

Posted By:   Christopher_Schultz  
Posted On:   Wednesday, January 23, 2002 06:18 AM

You will need a separate BoxLayout object for each Panel that you want to lay out. That means you can't call setLayout with the same layout manager to two different components.



-chris
About | Sitemap | Contact