dimanche 6 décembre 2015

Write the value of chosen Checkboxes in csv file

I tried to write it down selected device groups as list in csv file. However I could not manage. User choose the test group devices as you see in below figure : enter image description here

And when user click Save button I want to see such as similar output like [A],[A,C] or [A,B,D].

What I made:

List<JCheckBox> choosen = new ArrayList<>();
         JCheckBox checkA = new JCheckBox("Group A");
        centerPanel.add(checkA);
        JCheckBox checkB = new JCheckBox("Group B");
        centerPanel.add(checkB);
        JCheckBox checkC = new JCheckBox("Group C");
        centerPanel.add(checkC);
        JCheckBox checkD = new JCheckBox("Group D");
        centerPanel.add(checkD);

btnSave = new JButton("Save");
        btnSave.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {

                {
                    String jobName = jobNameField.getText();

                    ....


                    String testDevice = null; // I could not manage

                }

// RuleHelper is another class that I write my csv file 
RuleHelper.writeToFile(...,...,...,testDevice,) }

            }
            });

Thank you




Aucun commentaire:

Enregistrer un commentaire