Click here to Skip to main content
15,561,685 members
Home / Discussions / Java
   

Java

 
QuestionRe: Radio Button Selected Pin
ZurdoDev25-Mar-20 11:39
professionalZurdoDev25-Mar-20 11:39 
AnswerRe: Radio Button Selected Pin
MallardsReach25-Mar-20 12:11
MallardsReach25-Mar-20 12:11 
QuestionRe: Radio Button Selected Pin
ZurdoDev25-Mar-20 13:19
professionalZurdoDev25-Mar-20 13:19 
AnswerRe: Radio Button Selected Pin
Richard MacCutchan26-Mar-20 1:16
mveRichard MacCutchan26-Mar-20 1:16 
GeneralRe: Radio Button Selected Pin
MallardsReach26-Mar-20 1:28
MallardsReach26-Mar-20 1:28 
GeneralRe: Radio Button Selected Pin
Richard MacCutchan26-Mar-20 1:36
mveRichard MacCutchan26-Mar-20 1:36 
GeneralRe: Radio Button Selected Pin
MallardsReach26-Mar-20 3:55
MallardsReach26-Mar-20 3:55 
GeneralRe: Radio Button Selected Pin
MallardsReach26-Mar-20 5:15
MallardsReach26-Mar-20 5:15 
Talk about making things complicated!
Here is the final code, no user defined method was needed, I just had to place the results for pressing a button in the 'itemStateChanged method'
Java
ItemListener itemListener = new ItemListener() {
    public void itemStateChanged(ItemEvent itemEvent) {
        AbstractButton aButton = (AbstractButton)itemEvent.getSource();
            int state = itemEvent.getStateChange();
            String name = aButton.getText();
        for (int i = 1; i < rbTable.length; i++)
        {
            if (state == ItemEvent.SELECTED) {
                if (name.equals(rbTable[i].getText())) {
                    displayTable.setText(""); //Clear the displayTable
                    int firstNum, answerNum;
                    for (firstNum = 1; firstNum <=12; firstNum ++)
                    {
                        answerNum = firstNum * i;
                        displayTable.append(" " + firstNum + " x " + i + " = " + answerNum +"\n");
                    }

                }
            }
        }
    }
};

QuestionUser defined Method Pin
MallardsReach24-Mar-20 3:56
MallardsReach24-Mar-20 3:56 
AnswerRe: User defined Method Pin
Richard MacCutchan24-Mar-20 5:18
mveRichard MacCutchan24-Mar-20 5:18 
GeneralRe: User defined Method Pin
MallardsReach24-Mar-20 8:39
MallardsReach24-Mar-20 8:39 
GeneralRe: User defined Method Pin
Richard MacCutchan24-Mar-20 8:44
mveRichard MacCutchan24-Mar-20 8:44 
GeneralRe: User defined Method Pin
MallardsReach24-Mar-20 9:29
MallardsReach24-Mar-20 9:29 
GeneralRe: User defined Method Pin
Richard MacCutchan24-Mar-20 11:16
mveRichard MacCutchan24-Mar-20 11:16 
GeneralRe: User defined Method Pin
MallardsReach24-Mar-20 23:17
MallardsReach24-Mar-20 23:17 
QuestionJTextArea Pin
MallardsReach23-Mar-20 1:48
MallardsReach23-Mar-20 1:48 
AnswerRe: JTextArea Pin
Richard MacCutchan23-Mar-20 1:54
mveRichard MacCutchan23-Mar-20 1:54 
QuestionCalling a Method at run time Pin
MallardsReach21-Mar-20 23:32
MallardsReach21-Mar-20 23:32 
AnswerRe: Calling a Method at run time Pin
Richard MacCutchan22-Mar-20 0:29
mveRichard MacCutchan22-Mar-20 0:29 
GeneralRe: Calling a Method at run time Pin
MallardsReach22-Mar-20 1:38
MallardsReach22-Mar-20 1:38 
GeneralRe: Calling a Method at run time Pin
Richard MacCutchan22-Mar-20 1:48
mveRichard MacCutchan22-Mar-20 1:48 
GeneralRe: Calling a Method at run time Pin
MallardsReach22-Mar-20 2:08
MallardsReach22-Mar-20 2:08 
GeneralRe: Calling a Method at run time Pin
Richard MacCutchan22-Mar-20 5:08
mveRichard MacCutchan22-Mar-20 5:08 
GeneralRe: Calling a Method at run time Pin
MallardsReach22-Mar-20 7:00
MallardsReach22-Mar-20 7:00 
QuestionMouse Dragged Event Pin
MallardsReach18-Mar-20 12:15
MallardsReach18-Mar-20 12:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.