Hello,
is it possible to display an Error message when we enter a number in jSpinner.
I tried this, in Netbeans i right-clicked the jSpinner , then go to
-Properties
-tooltiptext and write Range 1 to 200
-Model i choose the spinnermodel/Spinner Model Editor/Model type = number
model properties = Integer and set
-initial value=0
max= 400
min=0
set size=1
After i added this code:
public int getAlerte() {
int res = 0;
if (Integer.parseInt(jSpinnerDuree.getValue().toString()) <= 0 ||
Integer.parseInt(jSpinnerDuree.getValue().toString()) >1000) {
JOptionPane.showMessageDialog(this, "Run duration should be between 1 and 1000",
"Alert", JOptionPane.ERROR_MESSAGE);
res = 1;
}
So when i try my code, if i put -1 in the jSpinner it happens nothing, no error message displayed.
why please, can anyone explain my error.
Thank you