How do I start a program (that has four buttons) with three buttons disabled and one enabled. Also, when the button that is enabled is pressed I want it to become disabled and the other three to become enabled. Disregard the add and remove methods
but this is what I have so far, what should I add and/or change?
private void initButtonActionPerformed(java.awt.event.ActionEvent evt)
{
initButton.setEnabled(false);
}
private void displayButtonActionPerformed(java.awt.event.ActionEvent evt)
{
}
private void addButtonActionPerformed(java.awt.event.ActionEvent evt)
{
cdcollection.add(cdtitleInput.getText());
}
private void removeButtonActionPerformed(java.awt.event.ActionEvent evt)
{
cdcollection.remove(cdcollection.size()-1);
}
Am I missing something? Can’t you just call
setEnabled()on the buttons as you create them?To change the status in the listeners, again, just call
setEnabled()on the relevant buttons.Perhaps you should look into radio buttons – sounds like that is what you are trying to imitate…