Clase jugada:
public class Jugada extends JPanel{
GroupLayout GL = null;
public Jugada() {
setBorder(javax.swing.BorderFactory.createTitledBorder("MiJugada"));
setName("MiJugadaName");
setLocation(100, 100);
GL = new javax.swing.GroupLayout(this);
this.setLayout(GL);
System.out.println(this.getX());
GL.setHorizontalGroup(
GL.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 244, Short.MAX_VALUE)
);
GL.setVerticalGroup(
GL.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 31, Short.MAX_VALUE)
);
}
}
Y la clase principal (pongo solo un metodo, los otros son irrelevantes)
public class MenuPrincipalView extends JPanel {
[...]
private void initCustomComponent(Component C) {
javax.swing.GroupLayout layout = (GroupLayout) this.getLayout();
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(C, 100, 500, 1000)
.addContainerGap(313, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(C, 100, 500, 1000)
.addContainerGap(384, Short.MAX_VALUE))
);
}
[...]
}
Resultado: