Bonjour,
j'ai une classe nommé qui "slot" (qui est un jPanel) qui permet d'avoir une instance slot. j'ai un MouseClicked sur une autre classe (qui contient un bouton). je voudrais que lorsque je clique sur le bouton de l'autre classe, la couleur de mon jLabel change. que dois je faire ?!!

voici ma classe slot :
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
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
 
 
/*
 * Slot.java
 *
 
 
import java.awt.Color;
import java.awt.Dimension;
 
public class Slot extends javax.swing.JPanel {
    public Boolean TestB = false;
    /** Creates new form Slot */
    public Slot() {
        initComponents();
    }
 
    public Slot(String SlotNum, String MASGName) {
        initComponents();
        this.SlotNum = SlotNum;
        this.MASGName = MASGName;
    }
        public Slot(String SlotNum, String MASGName, String PTN_type) {
        initComponents();
        this.SlotNum = SlotNum;
        this.MASGName = MASGName;
        this.PTN_type = PTN_type;
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {
 
        internalText = new javax.swing.JLabel();
 
        setBackground(new java.awt.Color(255, 255, 255));
        setMaximumSize(new java.awt.Dimension(19, 217));
        setMinimumSize(new java.awt.Dimension(19, 217));
        setPreferredSize(new java.awt.Dimension(19, 217));
        addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                formMouseClicked(evt);
            }
        });
 
        internalText.setText("<html>S<br> L<br>O<br>T<br> <br>N</html>");
        internalText.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
 
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(internalText, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(internalText, javax.swing.GroupLayout.DEFAULT_SIZE, 195, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>                        
 
    private void formMouseClicked(java.awt.event.MouseEvent evt) {                                  
 
        TestDialog tf = new TestDialog(null,true);
         BoardAddGui bf = new BoardAddGui(SlotNum, MASGName, PTN_type);
 
         tf.jTabbedPane1.add(bf);
         bf.setBackground(Color.white);
         tf.jTabbedPane1.setTitleAt(0, "Board : Add");
 
         tf.setSize(new Dimension(700,500));
         tf.setVisible(true);
    }                                 
 
    public String getInternalText() {
        return internalText.getText();
    }
 
    public void setInternalText(String internalText) {
        this.internalText.setText(internalText);
    }
 
    public String getMASGName() {
        return MASGName;
    }
 
    public void setMASGName(String MASGName) {
        this.MASGName = MASGName;
    }
 
    public String getSlotNum() {
        return SlotNum;
    }
 
    public void setSlotNum(String SlotNum) {
        this.SlotNum = SlotNum;
    }
 
 
 
    private String SlotNum;
    private String MASGName;
    private String PTN_type;
    // Variables declaration - do not modify                     
    public javax.swing.JLabel internalText;
    // End of variables declaration                   
 
}