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


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

Re: Accessing super method from inner class?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Jeff Higgins <jeff@invalid.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Accessing super method from inner class?
Date Wed, 12 Nov 2014 21:54:05 -0500
Organization A noiseless patient Spider
Lines 38
Message-ID <m416lq$c72$1@dont-email.me> (permalink)
References <m4126g$bkp$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Thu, 13 Nov 2014 02:56:58 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="baa6bbcdf8becba88d8b4445c4009597"; logging-data="12514"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19xaL0c8mOwNT5XVsTAtQemqq4qw3J2kT0="
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.8.1
In-Reply-To <m4126g$bkp$1@dont-email.me>
Cancel-Lock sha1:+AWLMp2XR317Qwm6G9dRy2iBRDI=
Xref csiph.com comp.lang.java.programmer:30351

Show key headers only | View raw


On 11/12/2014 08:40 PM, Knute Johnson wrote:
> I've got some code where I am wrapping all the calls to
> JTextArea.append() in EventQueue.invokeLater().  So I thought I would
> just extend JTextArea but what I thought was obvious isn't.
>
> import java.awt.*;
> import javax.swing.*;
>
> public class KTextArea extends JTextArea {
>      public KTextArea(String text) {
>          super(text);
>      }
>
>      public void append(final String str) {
>          EventQueue.invokeLater(new Runnable() {
>              public void run() {
>                  KTextArea.this.super.append(str);

In this context, this means your new Runnable, super means Object,
and KTextArea.super means JTextArea, and KTextArea.this is undefined.

I think.

>              }
>          });
>      }
> }
>
>
> com\knutejohnson\cookbook\KTextArea.java:14: error: '(' expected
>                  KTextArea.this.super.append(str);
>                                      ^
> 1 error
>
> but KTextArea.super.append(str); appears to work.  Why doesn't it
> require the 'this'?
>

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


Thread

Accessing super method from inner class? Knute Johnson <eternal@knutejohnson.com> - 2014-11-12 17:40 -0800
  Re: Accessing super method from inner class? Jeff Higgins <jeff@invalid.invalid> - 2014-11-12 21:54 -0500
    Re: Accessing super method from inner class? Knute Johnson <eternal@knutejohnson.com> - 2014-11-13 10:01 -0800

csiph-web