I'm trying to program a fully functioning Windows 7 calculator in programmer mode. Right now, I'm just working on getting the buttons to work properly. So I want for the buttons that will be used for hexa to be disabled until the radio button for hex is selected. So the A-F buttons will be disabled while in dec or Bint mode until it is selected otherwise.
Here is the button A:
JButton button_A = new JButton("A");
button_A.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
button_A.setEnabled(false);
hexDisable();
textField.setText(textField.getText() + "A");
}
});
Here is the radio button:
JRadioButton rButton_Hex = new JRadioButton("Hex");
rButton_Hex.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
hexDisable();
}
});
rButton_Hex.setBounds(9, 218, 54, 23);
contentPane.add(rButton_Hex);
Group1.add(rButton_Hex);
This is the method that will enable and disable the appropriate buttons.
public void hexDisable(){
button_A.setEnabled(true);
}
I'm extremely new to using GUIs in Java.