I have 2 spinners, each one with its corresponding values taken from a string:
SpinnerListModel pal = new SpinnerListModel(palabras );
spinner = new javax.swing.JSpinner(pal);
SpinnerListModel word = new SpinnerListModel(words);
spinner1 = new javax.swing.JSpinner(word);
and these are the arrays that are previously declared:
static String palabras[] = {"hola", "manzana", "leon", "castillo", "videojuego"};
static String words[] = {"hello", "apple", "lion", "castle", "videogame"};
My problem arises when I try to compare the values that they have in the spinner, when I press a button I get the values in the following way:
private void btnComprobarActionPerformed(java.awt.event.ActionEvent evt) {
//prueba.setText(String.valueOf(spinner.getValue()));
if(String.valueOf(spinner).equals("hola")&& String.valueOf(spinner1).equals("hello")){
prueba.setText("Correcto");
}
}
If I get the value and I show it in the text it shows the word it contains at the moment, but if I compare it it does not show anything, which may be failing?