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?

Path csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: How to prevent typing value into JSpinner?
Date Thu, 16 Jul 2015 12:17:37 -0400
Organization A noiseless patient Spider
Lines 20
Message-ID <mo8lce$5oj$1@dont-email.me> (permalink)
References <mo8kva$3d0$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Thu, 16 Jul 2015 16:16:14 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="858a9d65d95f4ea4d355bd116aa2cdbf"; logging-data="5907"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/oODu9ElwFNA2cuzImocHi"
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0
In-Reply-To <mo8kva$3d0$1@dont-email.me>
Cancel-Lock sha1:wVXweGmje+XF6XOviMrALw+V920=
Xref csiph.com comp.lang.java.programmer:32048

Show key headers only | 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