hi I have problem in result of my program : the event not generated and the result not shown,
Please help me to solve this , I am beginner in Java I use Netbeans.
thanks ./* * To change this template, choose Tools | Templates * and open the template in the editor. */ package score; /** * * @author hhbest */ import javax.swing.*; import java.awt.*; import java.util.*; import java.awt.event.*; import javax.swing.border.Border; //le class commence ici /** * * @author hhbest */ public class Score extends JFrame implements ActionListener,ItemListener { ButtonGroup option = new ButtonGroup(); ButtonGroup option1 = new ButtonGroup(); ButtonGroup option2 = new ButtonGroup(); ButtonGroup option3 = new ButtonGroup(); int rep; int clcScore; // ROW 1 JPanel row1 = new JPanel(); JCheckBox rep1 = new JCheckBox("Oui", false); JCheckBox rep2 = new JCheckBox("Nom", false); JLabel testlabel= new JLabel("Je prends facilement et regulierement les avis des autres sur mon travail......" , JLabel.LEFT); // ROW 2 JPanel row2 = new JPanel(); JCheckBox rep3 = new JCheckBox("Oui", false); JCheckBox rep4 = new JCheckBox("Nom", false); JLabel testlabel2= new JLabel("Je prends facilement et regulierement les avis des autres sur mon travail......" , JLabel.LEFT); // ROW 3 JPanel row3 = new JPanel(); JCheckBox rep5 = new JCheckBox("Oui", false); JCheckBox rep6 = new JCheckBox("Nom", false); JLabel testlabel3= new JLabel("Je prends facilement et regulierement les avis des autres sur mon travail......" , JLabel.LEFT); // ROW 4 BorderLayout crisisLayout = new BorderLayout(); JPanel row4 = new JPanel(); JLabel testlabel4= new JLabel("le resulta est: 0 " , JLabel.LEFT); public Score () { super("Mon style de communication"); setLookAndFeel(); setSize(650, 300); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GridLayout layout = new GridLayout(5, 1, 10, 10); setLayout(layout); FlowLayout layout1 = new FlowLayout(FlowLayout.LEFT,10, 10); FlowLayout layout2 = new FlowLayout(FlowLayout.LEFT,10, 10); FlowLayout layout3 = new FlowLayout(FlowLayout.LEFT,10, 10); FlowLayout layout4 = new FlowLayout(FlowLayout.LEFT,10, 10); // GRAPHIC ROW 1 row1.setLayout(layout1); row1.add(testlabel); option.add(rep1); option.add(rep2); row1.setLayout(layout1); row1.add(rep1); row1.add(rep2); add(row1); // GRAPHIC ROW 2 row2.setLayout(layout2); row2.add(testlabel2); option1.add(rep3); option1.add(rep4); row2.setLayout(layout2); row2.add(rep3); row2.add(rep4); add(row2); // GRAPHIC ROW 3 row3.setLayout(layout3); row3.add(testlabel3); option2.add(rep5); option2.add(rep6); row3.setLayout(layout3); row3.add(rep5); row3.add(rep6); add(row3); // Graphic ROW 4 row4.setLayout(layout4); JButton calaculBtn = new JButton("Calculer"); row4.add(calaculBtn, BorderLayout.NORTH); row4.add(testlabel4); add(testlabel4); add(calaculBtn); FlowLayout flo = new FlowLayout(); setLayout(flo); add(calaculBtn); // Events rep1.addItemListener(this); rep3.addItemListener(this); rep5.addItemListener(this); calaculBtn.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent event) { String Calculer = event.getActionCommand(); while (Calculer == event.getSource() ) { clcScore = (rep++)/2; testlabel4.setText(Integer.toString(clcScore)); } } }); setVisible(true); } /** * * @param e */ public void itemStatechanged(ItemEvent event){ if(event.getStateChange() == ItemEvent.SELECTED){ rep=1; } else if(event.getStateChange() == ItemEvent.DESELECTED){ rep = 0; } } /** * * @param event */ private void setLookAndFeel() { try { UIManager.setLookAndFeel( "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel" ); } catch (Exception exc) { // ignior errors } }/** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Score Sc = new Score(); } @Override public void itemStateChanged(ItemEvent ie) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void actionPerformed(ActionEvent ae) { throw new UnsupportedOperationException("Not supported yet."); } }