set directory with action listener
<p>I have a rename tool that sets a folder directory, however I created some JCheckBox and I want them to be able to change the directory depending on which is selected.</p>

<p>Her is the action listener for the checkbox, it edits the txt field so it looks right on the program but does not actually change the directory.</p>

<pre><code>cbxBlackBerry = new JCheckBox("BlackBerry");
        cbxBlackBerry.addActionListener(
                new ActionListener(){
                    public void actionPerformed(ActionEvent e){
                            if(cbxBlackBerry.isSelected())
                            txtPrefix.setText("x-rimdevice_");
                        else{
                            txtPrefix.setText("");
                        }

                        if(cbxBlackBerry.isSelected())
                            txtDirectory.setText("\\RSASoftToken\\blackberry");
                        else{
                            txtDirectory.setText("");
                        }
                    }
                }
            ); //close addActionListener
</code></pre>

<p>this is the code that commands the directory setting</p>

<pre><code>private boolean chooseDirectory(){

        /* Choose the file Directory
         * this will ensure that the class variable directory get the value
         * only when a directory is chosen, then the button Ok will be enabled
         */

        JFileChooser fc = new JFileChooser();
        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        fc.setAcceptAllFileFilterUsed(false);

        int returnval = fc.showOpenDialog(this);

        if(returnval == JFileChooser.APPROVE_OPTION){
            directory = fc.getSelectedFile();
            btnOk.setEnabled(true);
            return true;        
        }

        return false;
    }// end chooseDirectory
</code></pre>

<p>How do I modify this code to actually change the directory?</p>

<pre><code>if(cbxBlackBerry.isSelected())
                            txtDirectory.setText("\\RSASoftToken\\blackberry");
                        else{
                            txtDirectory.setText("");
</code></pre>
