Buscar
Social
Ofertas laborales ES

Foro sobre Java SE > Problema con GroupLayout

This is my source:

javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);

layout.setHorizontalGroup(layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addGroup(
layout.createSequentialGroup().addContainerGap().addComponent(
jTabbedPaneRaiz,javax.swing.GroupLayout.DEFAULT_SIZE, 457,
Short.MAX_VALUE).addContainerGap()));

layout.setVerticalGroup(layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addGroup(
layout.createSequentialGroup().addContainerGap().addComponent(
jTabbedPaneRaiz,javax.swing.GroupLayout.DEFAULT_SIZE, 402,
Short.MAX_VALUE).addContainerGap()));

When I compile, Eclipse shows in console:

java.lang.IllegalArgumentException: GroupLayout can only be used with one Container at a time
at javax.swing.GroupLayout.checkParent(Unknown Source)
at javax.swing.GroupLayout.invalidateLayout(Unknown Source)
at java.awt.Container.invalidate(Unknown Source)
at java.awt.Component.addNotify(Unknown Source)
at java.awt.Container.addNotify(Unknown Source)
at javax.swing.JComponent.addNotify(Unknown Source)
at java.awt.Container.addImpl(Unknown Source)
at java.awt.Container.add(Unknown Source)
at javax.swing.GroupLayout.getComponentInfo(Unknown Source)
at javax.swing.GroupLayout.access$600(Unknown Source)
at javax.swing.GroupLayout$ComponentSpring.(Unknown Source)
at javax.swing.GroupLayout$ComponentSpring.(Unknown Source)
at javax.swing.GroupLayout$Group.addComponent(Unknown Source)
at javax.swing.GroupLayout$SequentialGroup.addComponent(Unknown Source)
at frontEnd.Interfaz.initComponents(Interfaz.java:311)
at frontEnd.Interfaz.init(Interfaz.java:66)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


Where is my problem? Line 311, but... i don't understand what i do bad...

mayo 15, 2015 | Unregistered Commenterdavidfdez