Bonjour,
Je ne m'en sors pas avec le positionnement de mon Jlabel
Dans mon interface, j'ai 2 onglets avec JTabbedPane
Dans chaque onglet j'ai mis un JPanel et je veux afficher plusieurs éléments sur ce JPanel, mais commençons par un JLabel tout simple.
Sur un onglet ça fonctionne bien et sur l'autre non ! mon label reste désespérément planté au milieu du panel, alors que je voudrais l'ancrer en haut GridBagConstraints.PAGE_START
Voici mon code:
Pouvez-vous m'aider ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 jPanel1 = new JPanel(); jPanel1.setLayout(new GridBagLayout()); GridBagConstraints gridBagConstraints4 = new GridBagConstraints(); gridBagConstraints4.gridx = 0; gridBagConstraints4.anchor = GridBagConstraints.PAGE_START; gridBagConstraints4.gridy = 0; jLabel = new JLabel(); jLabel.setText(" Simulation"); jLabel.setForeground(Color.WHITE); jLabel.setFont(new Font("Dialog", Font.BOLD, 13)); jLabel.setBackground(Color.gray); jLabel.setOpaque(true); // le titre jPanel1.add(jLabel, gridBagConstraints4);
Merci.
Partager