use JRadioButton to determine what Object to work with

42 views Asked by At

I need to use two JRadioButtons (already set up the ButtonGroup) to determine which of two Objects will be worked with.

savingsButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            AbstractButton aButton = (AbstractButton) e.getSource();
            if (aButton == savingsButton) {
                //set the target Object to savingsAccount
            }
        } 
    });

The other ActionListener is identical, save for swapping checkingAccount for savingsAccount.

How can I accomplish this?

0

There are 0 answers