Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By DarrylBurke

Thread: Help with JSpinner

  1. #1
    cyentw is offline Member
    Join Date
    Jan 2013
    Posts
    14
    Rep Power
    0

    Default Help with JSpinner

    Just a quick question: Is there a way to get the value of a JSpinner?

    I want the program to print out what the value of the JSpinner is, with something like this:
    Java Code:
    System.out.println(Myjspinner.getValue)
    but this does not work.

    Help!

    Thanks!

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default Re: Help with JSpinner

    Quote Originally Posted by cyentw View Post
    Just a quick question: Is there a way to get the value of a JSpinner?
    The JSpinner API will list all methods that are available to you, including one called getValue().

    I want the program to print out what the value of the JSpinner is, with something like this:
    Java Code:
    System.out.println(Myjspinner.getValue)
    but this does not work.
    If your code doesn't work, please tell us exactly how it's not working including misbehaviors and all error messages and exceptions, because "doesn't work" doesn't give us much to go on if we're to try to figure out what's wrong. One thing that bugs me about your post is that you don't seem to be calling a true method since your getValue is missing the terminal parenthesis that are required of all method calls. The other key bit of information is knowing exactly where you're trying to do this call. If it's in a constructor or other initialization code, then it will be called before the user has had a chance to interact with the spinner, and so usually you'll try to extract the spinner's value in some event-triggered code.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: Help with JSpinner

    Better to learn how to call methods in Java before you venture into GUIs.
    Lesson: Classes and Objects (The Java™ Tutorials > Learning the Java Language)

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,457
    Rep Power
    20

    Default Re: Help with JSpinner

    Quote Originally Posted by Fubarable View Post
    Hey Darryl!
    Beaten by seconds!
    Fubarable likes this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Input from jspinner
    By hiyamandal in forum AWT / Swing
    Replies: 1
    Last Post: 04-13-2012, 08:52 AM
  2. Help me! how to use JSpinner
    By ngankt2 in forum AWT / Swing
    Replies: 1
    Last Post: 11-05-2010, 08:07 PM
  3. JSpinner problem
    By damlui in forum AWT / Swing
    Replies: 0
    Last Post: 09-29-2010, 04:15 PM
  4. One Jspinner modifying the value of the other
    By cotarelo in forum AWT / Swing
    Replies: 1
    Last Post: 06-11-2010, 03:48 PM
  5. JSpinner resizes, I don't want that.
    By JosAH in forum AWT / Swing
    Replies: 4
    Last Post: 05-30-2010, 10:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •