Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 700
  • Last Modified:

Putting a value in a JSpinner

Just a simple question....how do you insert a default value into a JSpinner?

try {
     settingsGui.spinnerPort.setValue("25");
}
catch (IllegalArgumentException iae) {
}

If i wanted to put the int value '25' in there, what would i put in? What i have above doesn't work
0
BaconAndCabbage
Asked:
BaconAndCabbage
  • 2
1 Solution
 
91mustangCommented:
spinner.setValue(new Integer(25));
0
 
91mustangCommented:
rather:

try {
     settingsGui.spinnerPort.setValue(new Integer(25));
}
catch (IllegalArgumentException iae) {
}
0
 
CEHJCommented:
Don't have empty catch blocks - it can (if it has not already) lead to bugs that are difficult to detect
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now