HHH
How to Display an alert message when nothing is selected in jspinner in java?
0 Answer(s)      2 years and 4 months ago
Posted in : Java Beginners

Hello,

i'm trying to code a jspinner in java and i want to display a message when nothing is selected. My initial value is 0 min value = 0 max value = 200

so when the application is running it displays the jspinner with the initial value = 0 what i want is if the user did not select the jspinner an alert message should appears. here is what i tried without success.

public int getAlerte() { int x = 0;

    if (Integer.parseInt(jSpinnerParameter.getValue().toString()) <= 0 ||
    Integer.parseInt(jSpinnerParameter.getValue().toString()) >200){
    JOptionPane.showMessageDialog(this, "Color Number should be 1 minimum",
            "Alert", JOptionPane.ERROR_MESSAGE);
    x = 1;
}       

     return x;

}

the Alert message is never displayed,please i need help. Thank you

Advertisement
View Answers









Related Tutorials/Questions & Answers:
Advertisements