Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #2369
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.help |
| Subject | Re: Need example how to use events with a jcombobox |
| Date | 2012-12-18 17:01 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <kaqp4c$ga3$1@dont-email.me> (permalink) |
| References | <b87137f0-ad0d-4884-a6e5-0b2e534d34c9@googlegroups.com> <kaqlhn$olq$1@dont-email.me> <0cc9e12a-8bbb-4f61-929c-7017d72298a4@googlegroups.com> <kaqnsd$7te$1@dont-email.me> |
On 12/18/2012 4:40 PM, markspace wrote:
> On 12/18/2012 1:23 PM, kedward777@gmail.com wrote:
> > Is there another
>> approach that is well documented and more easily implemented? I can't
>> believe this hasn't been done before(?)
>
> Seriously, no. This is the best, and easiest, way I can think of.
>
> Sometimes programming is just complex, period. Not much to be done
> about that except suck it up and write the code.
Right. The lower you go, the less help you get from the
layers you've bypassed, and hence the more you've got to do for
yourself. Kedward, consider yourself lucky to be handling
DocumentEvents instead of keyboard interrupts ...
> The only gotcha in Eric's outline I might see is firing an event on
> exactly 3 characters. I think you should fire an event on any character
> change. The reason is you're probably going to want to search again for
> 4 character, 5 characters, etc. And if the user backspaces to 2
> characters, you'll want to clear the search results. So firing an event
> for every change sounds best to me.
Sounds good to me. Might not want to populate the ComboBoxModel
when there are too few characters to keep the possibilities to a
reasonable limit (I imagine that's why he specified three). A more
flexible approach might take the number of matches into account
along with the prefix length, something like "Populate the model
when there are fewer than M matches, or when the prefix holds N
or more characters." That way, ZBIGNIEWSKI and ZORRO could pop
up as soon as Z was pressed, while STI might wait for more input
before trying to display STIBICH, STICH, STICHTER, STICKELS,
STICKMAN, ..., STIVER, STIVES, STIX, all umpty thousand of 'em.
--
Eric Sosman
esosman@comcast-dot-net.invalid
Back to comp.lang.java.help | Previous | Next — Previous in thread | Find similar | Unroll thread
Need example how to use events with a jcombobox kedward777@gmail.com - 2012-12-18 11:20 -0800
Re: Need example how to use events with a jcombobox Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-18 15:17 -0500
Re: Need example how to use events with a jcombobox Gunter Herrmann <notformail0106@earthlink.net> - 2012-12-18 17:40 -0500
Re: Need example how to use events with a jcombobox markspace <-@.> - 2012-12-18 13:00 -0800
Re: Need example how to use events with a jcombobox kedward777@gmail.com - 2012-12-18 13:23 -0800
Re: Need example how to use events with a jcombobox markspace <-@.> - 2012-12-18 13:40 -0800
Re: Need example how to use events with a jcombobox Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-12-18 17:01 -0500
csiph-web