i need help with the punctuation check box. there's no supposed to be punctuation when it's not check. Im using netbeans. new

here's my code

neww

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package passwordgenerator;

/**
 *
 * @author Windows
 */
import javax.swing.JCheckBox;
public class ClsOperator {

public String stringEquiv;

         public String getPassword(int spinnerValue, Object specialSignCheckBox) {

      final String charPool[] = {
        "a", "b", "c", "d", "e", "f", "g", "h",
        "i", "j", "k", "l", "m", "n", "o", "p",
        "q", "r", "s", "t", "u", "v", "w", "x",
        "y", "z", "A", "B", "C", "D", "E", "F",
        "G", "H", "I", "J", "K", "L", "M", "N",
        "O", "P", "Q", "R", "S", "T", "U", "V",
        "W", "X", "Y", "Z", "0", "1", "2", "3",
        "4", "5", "6", "7", "8", "9", "'", "!",
        "?", "@", "#", "$", "%", "^", "&", "&",
        "*", "*", "(", ")", "-", "+", "=", "_",
        "~", ".", ",", "[", "]", "{", "}", "|",
        ":", ";", "/"
    };

      String equiv[] = {
        "alpha", "bravo", "charlie", "dello", "echo", "foxtrot", "golf", "hotel",
        "india", "juliet", "kilo", "lima", "mile", "november", "oscar", "papa",
        "quebec", "romeo", "sierra", "tango", "uniform", "victor", "whiskey", "x-ray",
        "yankee", "zulu", "ALPHA", "BRAVO", "CHARLIE", "DELLO", "ECHO", "FOXTROT",
        "GOLF", "HOTEL", "INDIA", "JULIET", "KILO", "LIMA", "MILE", "NOVEMBER",
        "OSCAR", "PAPA", "QUEBEC", "ROMEO", "SIERRA", "TANGO", "UNIFORM", "VICTOR",
        "WHISKEY", "X-RAY", "YANKEE", "ZULU", "0", "1", "2", "3",
        "4", "5", "6", "7", "8", "9", "'", "!",
        "?", "@", "#", "$", "%", "^", "&", "&",
        "*", "*", "(", ")", "-", "+", "=", "_",
        "~", ".", ",", "[", "]", "{", "}", "|",
        ":", ";", "/"



      };
        String password = " ";
        String passEquiv = " ";
        int rndNumber;
        for (int i = 0; i < spinnerValue; i++) {
            if (!specialSignCheckBox.isSelected()) {
                rndNumber = (int) (Math.random() * 62);
                password = password.concat(charPool[rndNumber]);
            } else {
                rndNumber = (int) (Math.random() * 91);
                password = password.concat(charPool[rndNumber]);

                passEquiv = passEquiv.concat(equiv[rndNumber]+ "   "+"\n");
                stringEquiv = passEquiv;
//            }
        }
        return password;
    }

         }
}

That looks OK. Maybe the problem is somewhere else in your code. Are you sure that the specialSignCheckBox variable in this method is referring to the right instance of the right check box? You could try printing specialSignCheckBox.isSelected() to confirm that you are getting the correct value at around line 52.
ps: You define the specialSignCheckBox parameter as an Object, so its surprising that specialSignCheckBox.isSelected() will even compile, based on the code fragment you posted.

This article has been dead for over six months. Start a new discussion instead.