Problème avec mon interface Swing
Bonjour j'ai deux classe java, toutes deux étendent JPanel à l'intérieur de l'une, j'ai crée une toute petite GUI comportant un panel cliquable et un label et j'utilise cette GUI dans l'autre classe. le problème c'est que celà ne s'affiche pas et je ne sais pas pourquoi. Pour vous aider à mieux m'aider, voici les bout de code :
1 - Classe contenant un panel et un label
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| public class CurvePicturePanel extends JPanel{
private static final long serialVersionUID = -4062779233664592343L;
private static ResourceBundle bundle = ResourceBundle.getBundle(Constances.getI18N(), new Locale(Constances.LANG));
private boolean clickable = false;
public CurvePicturePanel(){
super();
GUI();
}
public CurvePicturePanel(boolean bool){
super();
this.clickable = bool;
GUI();
}
private void GUI(){
{
GroupLayout thisLayout = new GroupLayout(this);
this.setLayout(thisLayout);
this.setPreferredSize(new java.awt.Dimension(157, 178));
{
picture = new PicturePanel(clickable);
GroupLayout pictureLayout = new GroupLayout(picture);
picture.setLayout(pictureLayout);
picture.setBorder(new LineBorder(new Color(0,128,192)));
pictureLayout.setVerticalGroup(pictureLayout.createParallelGroup());
pictureLayout.setHorizontalGroup(pictureLayout.createParallelGroup());
}
{
texteAfficher = new JLabel();
texteAfficher.setText(bundle.getString("label.photo.texte"));
texteAfficher.setOpaque(true);
}
thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
.addContainerGap()
.addComponent(picture, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(texteAfficher, 0, 35, Short.MAX_VALUE)
.addContainerGap());
thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
.addGap(7)
.addGroup(thisLayout.createParallelGroup()
.addGroup(thisLayout.createSequentialGroup()
.addComponent(picture, GroupLayout.PREFERRED_SIZE, 143, GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(texteAfficher, GroupLayout.Alignment.LEADING, 0, 143, Short.MAX_VALUE))
.addContainerGap());
}
}
private PicturePanel picture;
private JLabel texteAfficher;
public PicturePanel getPicture() {
return picture;
}
} |
2 - Classe dans laquelle je l'appelle
Code:
CurvePicturePanel picture_jPanel = new CurvePicturePanel();