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


Groups > comp.lang.java.programmer > #37844 > unrolled thread

How do you listen to GUI?

Started byEric Douglas <e.d.programmer@gmail.com> (Eric Douglas)
First post2017-12-12 13:57 +1200
Last post2017-12-12 13:57 +1200
Articles 1 — 1 participant

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


Contents

  How do you listen to GUI? Eric Douglas <e.d.programmer@gmail.com> (Eric Douglas) - 2017-12-12 13:57 +1200

#37844 — How do you listen to GUI?

FromEric Douglas <e.d.programmer@gmail.com> (Eric Douglas)
Date2017-12-12 13:57 +1200
SubjectHow do you listen to GUI?
Message-ID<3937588803@f38.n261.z1.binkp.net>
Many GUI objects have to listen to themselves, such as the JTree listener that
expands or collapses nodes.  I've seen this done in many classes in different
ways.  Is there really a best practice, has the best practice simply changed
over time, or is there a reason for doing it each way?

Many test classes you'll find on the internet simply have the class implement
the listener class and add itself as the listener.  I did some of this and at
some point thought it seemed odd for a class to implement a listener interface
if it'll only ever listen to itself and wrote some listeners as anonymous
classes.  I have a few listener methods that looked too complex so I made them
inner classes.  Now I've noticed at least in some places like JTree, Oracle
uses an inner class which extends a class called AccessibleJComponent, and I
don't understand why.

[toc] | [standalone]


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


csiph-web