Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #32048

Re: How to prevent typing value into JSpinner?

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: How to prevent typing value into JSpinner?
Date 2015-07-16 12:17 -0400
Organization A noiseless patient Spider
Message-ID <mo8lce$5oj$1@dont-email.me> (permalink)
References <mo8kva$3d0$1@dont-email.me>

Show all headers | View raw


On 7/16/2015 12:10 PM, Knute Johnson wrote:
> Anybody know how to prevent a user from typing a value into a JSpinner
> but still have it spin?

     According to

http://docs.oracle.com/javase/tutorial/uiswing/components/spinner.html

     "... if you implement a spinner model that does not descend from
     SpinnerListModel, SpinnerNumberModel, or SpinnerDateModel, then the
     spinner's default editor is a non-editable instance of
     JSpinner.DefaultEditor."

So it appears you have a couple of possibilities.  One, you could use a
custom model, or two, you could set a custom editor (possibly just a
raw JSpinner.DefaultEditor instance).  Good luck!

-- 
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to prevent typing value into JSpinner? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-07-16 09:10 -0700
  Re: How to prevent typing value into JSpinner? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-07-16 12:17 -0400
    Re: How to prevent typing value into JSpinner? Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-07-16 09:30 -0700

csiph-web