How to access JSpinner's JTextField?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: How to access JSpinner's JTextField?

  1. #1
    Join Date
    Jun 2004
    Posts
    29

    How to access JSpinner's JTextField?

    Hello,

    I'm working with a JSpinner and I need to set its' focus with a call to requestFocusInWindow(), but I forget how to get access to its' JTextField. I've tried saying "Spinner.requestFocusInWindow()" but that doesn't seem to do anything and I know the JSpinner has a JTextField which it uses to display and edit the value. I'd like to make a call like "Spinner.getTextField().requestFocusInWindow()" but I don't remember how to gain access to the JTextField (the aformentioned quote doesn't work). Does anybody know how to do this?

    Gib

  2. #2
    Join Date
    Sep 2004
    Posts
    223
    its simply:

    getValue(); however, this will return an "Object" so youll probably have to cast the return value as a String or whatever you want.
    A kram a day keeps the doctor......guessing

  3. #3
    Join Date
    Jun 2004
    Posts
    29
    This will give me the value entered into the JSpinner, and I could cast it as a String. But what I asked was, how do I set the focus for the JSpinner. JSpinner.requestFocusForWindow() doesn't work but I know it can be done, and it's done through calling requestFocusForWindow() on the embedded JTextField. JSpinner.getValue() will not give me the JTextField, and my question is: What will?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center