Bonjour,

Je tente de réaliser un programme Java sous Eclipse, avec le module Window Builder et j'ai un problème que je n'arrive pas à résoudre.

J'aimerais sélectionner des objets dans différentes Combobox sur une page, "enregistrer" ces valeurs pour ensuite afficher une image correspondant aux variables sélectionnées sur une deuxième page.

Voici le code de la 1ère page :

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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
package isn;
 
import java.awt.BorderLayout;
 
public class page1 extends JFrame {
 
    private JPanel contentPane;
    private JComboBox comboBox;
    private JComboBox comboBox_1;
    private JRadioButton rdbtnNewRadioButton;
    private JRadioButton rdbtnNewRadioButton_1;
    private JLabel lblIndiquerUneCouleur;
    private JLabel lblEtesVousUn;
    private JLabel lblIndiquezLaMto;
    private JLabel lblNewLabel;
    private JComboBox comboBox_2;
    private final ButtonGroup buttonGroup = new ButtonGroup();
    private JButton btnNewButton;
 
    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    page1 frame = new page1();
                    frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
 
    /**
     * Create the frame.
     */
    public page1() {
        setTitle("Vet'Appli");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setBounds(100, 100, 741, 571);
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        setContentPane(contentPane);
        contentPane.setLayout(null);
        contentPane.add(getComboBox());
        contentPane.add(getComboBox_1());
        contentPane.add(getRdbtnNewRadioButton());
        contentPane.add(getRdbtnNewRadioButton_1());
        contentPane.add(getLblIndiquerUneCouleur());
        contentPane.add(getLblEtesVousUn());
        contentPane.add(getLblIndiquezLaMto());
        contentPane.add(getComboBox_2());
        contentPane.add(getBtnNewButton());
        contentPane.add(getLblNewLabel());
    }
    private JComboBox getComboBox() {
        if (comboBox == null) {
            comboBox = new JComboBox();
            comboBox.setModel(new DefaultComboBoxModel(new String[] {"Rouge", "Blanc", "Noir", "Vert", "Bleu"}));
            comboBox.addContainerListener(new ContainerAdapter() {
            });
            comboBox.setMaximumRowCount(10);
            comboBox.setBounds(363, 155, 151, 22);
        }
        return comboBox;
    }
    private JComboBox getComboBox_1() {
        if (comboBox_1 == null) {
            comboBox_1 = new JComboBox();
            comboBox_1.setModel(new DefaultComboBoxModel(new String[] {"Et\u00E9", "Hiver"}));
            comboBox_1.setMaximumRowCount(2);
            comboBox_1.setBounds(363, 310, 151, 22);
        }
        return comboBox_1;
    }
    private JRadioButton getRdbtnNewRadioButton() {
        if (rdbtnNewRadioButton == null) {
            rdbtnNewRadioButton = new JRadioButton("homme");
            buttonGroup.add(rdbtnNewRadioButton);
            rdbtnNewRadioButton.setBackground(new Color(0, 204, 0));
            rdbtnNewRadioButton.addActionListener(new ActionListener() {
 
                @Override
                public void actionPerformed(ActionEvent arg0) {
                    // TODO Auto-generated method stub
 
                }
            });
            rdbtnNewRadioButton.setBounds(70, 155, 109, 23);
        }
        return rdbtnNewRadioButton;
    }
    private JRadioButton getRdbtnNewRadioButton_1() {
        if (rdbtnNewRadioButton_1 == null) {
            rdbtnNewRadioButton_1 = new JRadioButton("femme");
            buttonGroup.add(rdbtnNewRadioButton_1);
            rdbtnNewRadioButton_1.setBackground(new Color(0, 204, 0));
            rdbtnNewRadioButton_1.setBounds(70, 211, 109, 23);
        }
        return rdbtnNewRadioButton_1;
    }
    private JLabel getLblIndiquerUneCouleur() {
        if (lblIndiquerUneCouleur == null) {
            lblIndiquerUneCouleur = new JLabel("Indiquez une couleur");
            lblIndiquerUneCouleur.setBounds(363, 89, 119, 14);
        }
        return lblIndiquerUneCouleur;
    }
    private JLabel getLblEtesVousUn() {
        if (lblEtesVousUn == null) {
            lblEtesVousUn = new JLabel("\u00CAtes-vous un homme ou une femme ?");
            lblEtesVousUn.setBounds(38, 103, 226, 22);
        }
        return lblEtesVousUn;
    }
    private JLabel getLblIndiquezLaMto() {
        if (lblIndiquezLaMto == null) {
            lblIndiquezLaMto = new JLabel("Indiquez la saison");
            lblIndiquezLaMto.setBounds(363, 248, 109, 14);
        }
        return lblIndiquezLaMto;
    }
    private JLabel getLblNewLabel() {
        if (lblNewLabel == null) {
            lblNewLabel = new JLabel("");
            lblNewLabel.setIcon(new ImageIcon("C:\\Documents and Settings\\Th\u00E9ophane Choisnet\\Mes documents\\Dossier des pages Works\\projetfinal\\src\\projetfinal\\src\\imagefond.jpg"));
            lblNewLabel.setBounds(0, 0, 733, 551);
        }
        return lblNewLabel;
 
    }
    private JComboBox getComboBox_2() {
        if (comboBox_2 == null) {
            comboBox_2 = new JComboBox();
            comboBox_2.setBounds(363, 155, 151, 22);
        }
        return comboBox_2;
    }
    private JButton getBtnNewButton() {
        if (btnNewButton == null) {
            btnNewButton = new JButton("Ok");
            btnNewButton.setFont(new Font("Sylfaen", Font.PLAIN, 15));
            btnNewButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg0) {
                    //setVisible(false);
                    new page2().setVisible(true);
                    dispose();
                }
            });
            btnNewButton.setBackground(new Color(0, 204, 0));
            btnNewButton.setBounds(338, 470, 113, 41);
        }
        return btnNewButton;
    }
}
Quelqu'un saurait-il me guider un peu ?

Merci d'avance pour votre aide.