Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #35746
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Is there a better way to reference this? |
| Date | Tue, 11 Oct 2016 10:25:58 -0400 |
| Organization | A noiseless patient Spider |
| Lines | 35 |
| Message-ID | <ntisp7$u03$1@dont-email.me> (permalink) |
| References | <7fd3908d-6705-4034-99ee-08e4e3a4a4c6@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Tue, 11 Oct 2016 14:25:44 -0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="e2356f21ddee3cab595a60b882ae637d"; logging-data="30723"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ma56IMSFXzoFBdAQJyI2R" |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
| In-Reply-To | <7fd3908d-6705-4034-99ee-08e4e3a4a4c6@googlegroups.com> |
| Cancel-Lock | sha1:ztrVoLQ1SOV2hNzo847nHL+MvVg= |
| Xref | csiph.com comp.lang.java.programmer:35746 |
Show key headers only | View raw
On 10/11/2016 9:51 AM, Eric Douglas wrote:
> How to grab the instance from the inside without assigning?
> Sample:
>
> HashSet<JTable> storeTable = new HashSet();
> JTable myTable = new JTable() {
> {
> final JTable ref = this;
> addFocusListener(new FocusListener() {
>
> @Override
> public void focusGained(FocusEvent e) {
> storeTable.add(ref);
> }
>
> @Override
> public void focusLost(FocusEvent e) {
> }
>
> });
>
> }
> };
I think you're out of luck as things stand. If you were to use a
named class as your JTable subclass you could get rid of `ref' and use
`MyTableClass.this' inside the FocusListener, but as long as the JTable
extension remains anonymous I don't think there's any way to qualify
the `this'.
(Disclaimer: I'm no language lawyer, just a language paralegal.)
--
esosman@comcast-dot-net.invalid
The Tooth Fairy has gone high-tech, now pays in Bitecoin.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Is there a better way to reference this? Eric Douglas <e.d.programmer@gmail.com> - 2016-10-11 06:51 -0700
Re: Is there a better way to reference this? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-10-11 10:25 -0400
Re: Is there a better way to reference this? Eric Douglas <e.d.programmer@gmail.com> - 2016-10-11 07:37 -0700
Re: Is there a better way to reference this? Sebastian <nowhere@nirvana.org> - 2016-10-11 22:08 +0200
csiph-web