is there any other method than .isSelected() to check if radio button is selected

49
June 13, 2019, at 2:10 PM

i am helping my friend on a project

i have tried to add aditional events between the if statements but when i add them it seems top wrok properly is there any way to check is the radio button is selected as .isChecked doesn 't work for some weird reason

 private void btnPreveriMouseClicked(java.awt.event.MouseEvent evt) {                                        
        String compare = lblVprasanje.getText();
        if (compare.equals("question")) {
            if (rbtOdgovor3.isSelected()) {
        new Correct().setVisible(true);
                this.dispose();
            } else {
                new Wrong().setVisible(true);
                this.dispose();
            }
        }
        if (compare.equals("hello")) {
            if (rbtOdgovor2.isSelected()) {
                new Correct().setVisible(true);
                this.dispose();
            } else {
                new Wrong().setVisible(true);
                this.dispose();
            }
        }
        if (compare.equals("question")) {
            new DrugaStopnja().setVisible(true);
            if (rbtOdgovor3.isSelected()) {
                new Correct().setVisible(true);
                this.dispose();
            } else {
                new Wrong().setVisible(true);
                this.dispose();
            }
        }
        if (compare.equals("question")) {
            if (rbtOdgovor1.isSelected()) {
                new Correct().setVisible(true);
                this.dispose();
            } else {
                new Wrong().setVisible(true);
                this.dispose();
            }
        }

well if the correct radio button is selected the "correct" window should open but if the wrong one is the "wrong " window should. I dont understand why the .isSelected() is not working

READ ALSO
Saving the output of array permutations into a 2D array

Saving the output of array permutations into a 2D array

I am trying to save the permutation result of an array into a 2d arraylet's say I have an array {1,2,3,4}, I created a 2D array with rows: N! and columns 4

37
How to convert a string list to my specific java class

How to convert a string list to my specific java class

My problem is that I write a method that takes as parameter a list of my specific java class, and convert it to a String thanks to a getter of an information of the class and I return the string listI would now like to do the opposite, that is, I give it a string...

28
Jenkins Sonar Scanner vs Maven sonar:sonar goal

Jenkins Sonar Scanner vs Maven sonar:sonar goal

I tried running a sonar analysis using a java project on Jenkins using the standard maven sonar:sonar goal and also using the post step>> Execute SonarQube scannerThe maven goal I used is

33
Shuffling Characters in a String [on hold]

Shuffling Characters in a String [on hold]

guysHow do I shuffle characters in a string using only Math

29