Depends on what you're doing and how you are putting things together.
1 — One way is to declare the JRadioButton(s) as member variable (in class scope) and, in the ActionListener, check to see if the radioButton is selected.
2 — Another is to declare a member variable boolean which is set in an ActionListener which has been added to the radio button and in which the boolean is set. Then check the state of this boolean in the button ActionListener.
class Pseudo implements ActionListener {
JRadioButton radioButton;
boolean isItTrue = false;
Pseudo() {
radioButton = new JRadioButton("..."); // 1
// No listener is needed for radioButton.
// Its selection state is checked in the
// ActionListener of the JButton.
JRadioButton anotherRadio = new JRadioButton("..."); // 2
// Add an anonymous listener in which we set the
// member variable boolean for each user action
// on the "anotherRadio" radio button.
anotherRadio.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JRadioButton rb = (JRadioButton)e.getSource();
isItTrue = rb.isSelected();
}
});
JButton button = new JButton("...");
button.addActionListener(this);
// mount and show components...
}
public void actionPerformed(ActionEvent e) {
JButton button = (JButton)e.getSource();
if(radioButton.isSelected())
// one way to know...
if(isItTrue)
// another way to know...
}
}