Home Answers Viewqa Java-Beginners How to Display an alert message when nothing is selected in jspinner in java?

 
 


HHH
How to Display an alert message when nothing is selected in jspinner in java?
0 Answer(s)      5 months and 19 days 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

View Answers









Related Pages:

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.