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


Groups > comp.lang.java.gui > #3625 > unrolled thread

Re: How to clear or reset

Started by"Chris" <chris@THRWHITE.remove-dii-this>
First post2011-04-27 15:45 +0000
Last post2011-04-27 15:45 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.java.gui

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How to clear or reset "Chris" <chris@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000
    Re: How to clear or reset "tar" <tar@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000

#3625 — Re: How to clear or reset

From"Chris" <chris@THRWHITE.remove-dii-this>
Date2011-04-27 15:45 +0000
SubjectRe: How to clear or reset
Message-ID<a57d3813-b33e-4550-bafe-f67d87ff70ba@q27g2000prf.googlegroups.com>
  To: comp.lang.java.gui
On Jun 6, 11:42=A0am, "David A. Redick" <tinyweldingto...@gmail.com>
wrote:
> I would unhook (remove the listener) then setText or whatever, then
> rehook (add the listener back).

Thank you for your suggestion. Do you know any resources where I could
learn how to do this unhooking of the listener and rehooking?

I am basically trying to build a textfield where if certain key words
are entered a database query is executed (based on those words) and
the textfield is cleared. However, if certain key words are not
present (but words have been entered) in the textfield I want the
textfield to clear as well. This is my rationale behind the
TextListener and dilemma for setText("");

For all who have posted on this thread my most sincere thanks for your
time and expertise...

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#3627

From"tar" <tar@THRWHITE.remove-dii-this>
Date2011-04-27 15:45 +0000
Message-ID<ymiy75ebiqc.fsf@blackcat.isi.edu>
In reply to#3625
  To: comp.lang.java.gui
Chris <chrisliapis@gmail.com> writes:

> On Jun 6, 11:42Uaam, "David A. Redick" <tinyweldingto...@gmail.com>
> wrote:
> > I would unhook (remove the listener) then setText or whatever, then
> > rehook (add the listener back).
> 
> Thank you for your suggestion. Do you know any resources where I could
> learn how to do this unhooking of the listener and rehooking?

The general outline is very simple.

  1.  Use getYYYListeners to get a collection of the current listeners
  2.  Loop through the list removing them
  3.  setText("")
  4.  Loop through the listener list adding them again


-- 
Thomas A. Russ,  USC/Information Sciences Institute

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web