Solved

Putting a value in a JSpinner

Posted on 2004-04-25
3
694 Views
Last Modified: 2012-06-27
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
Comment
Question by:BaconAndCabbage
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
91mustang earned 20 total points
ID: 10912573
spinner.setValue(new Integer(25));
0
 
LVL 4

Expert Comment

by:91mustang
ID: 10912576
rather:

try {
     settingsGui.spinnerPort.setValue(new Integer(25));
}
catch (IllegalArgumentException iae) {
}
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10912690
Don't have empty catch blocks - it can (if it has not already) lead to bugs that are difficult to detect
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Maven Project: Hibernate Dependencies Conflict 10 40
ejb stateless example 2 27
Notify sent to other threads in Java 9 34
jsp error 6 27
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question