Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #37844 > unrolled thread
| Started by | Eric Douglas <e.d.programmer@gmail.com> (Eric Douglas) |
|---|---|
| First post | 2017-12-12 13:57 +1200 |
| Last post | 2017-12-12 13:57 +1200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.java.programmer
How do you listen to GUI? Eric Douglas <e.d.programmer@gmail.com> (Eric Douglas) - 2017-12-12 13:57 +1200
| From | Eric Douglas <e.d.programmer@gmail.com> (Eric Douglas) |
|---|---|
| Date | 2017-12-12 13:57 +1200 |
| Subject | How 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.
Back to top | Article view | comp.lang.java.programmer
csiph-web