Solved

Putting a value in a JSpinner

Posted on 2004-04-25
3
686 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
Comment Utility
spinner.setValue(new Integer(25));
0
 
LVL 4

Expert Comment

by:91mustang
Comment Utility
rather:

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

Expert Comment

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

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now