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


Groups > comp.lang.java.programmer > #35747

Re: Is there a better way to reference this?

Newsgroups comp.lang.java.programmer
Date 2016-10-11 07:37 -0700
References <7fd3908d-6705-4034-99ee-08e4e3a4a4c6@googlegroups.com> <ntisp7$u03$1@dont-email.me>
Message-ID <6f6d13d3-c131-4502-ab97-ae8043d33d26@googlegroups.com> (permalink)
Subject Re: Is there a better way to reference this?
From Eric Douglas <e.d.programmer@gmail.com>

Show all headers | View raw


On Tuesday, October 11, 2016 at 10:26:10 AM UTC-4, Eric Sosman wrote:
>      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'.

Ah OK, so there's that at least.
This simple extension of the JTable was the shortest I could come up with for sample code.  So if we have MyCustomTable extends JTable then create a listener inside a method of MyCustomTable we can reference the instance of the MyCustomTable the listener is being added to with the MyCustomTable.this.  I have seen that syntax before, haven't realized a practical use for it.

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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