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


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

Re: [foo.bar.Frame] can not inherit from [java.awt.Frame]

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe20.iad.POSTED!83aa503d!not-for-mail
From Daniel Pitts <newsgroup.nospam@virtualinfinity.net>
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: [foo.bar.Frame] can not inherit from [java.awt.Frame]
References <8d7bedc4-30a8-4dc4-97b6-9ddaafc2e16a@l4g2000vbt.googlegroups.com>
In-Reply-To <8d7bedc4-30a8-4dc4-97b6-9ddaafc2e16a@l4g2000vbt.googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Lines 29
Message-ID <YVjhr.15938$5m.2162@newsfe20.iad> (permalink)
X-Complaints-To abuse@newsrazor.net
NNTP-Posting-Date Wed, 11 Apr 2012 18:18:32 UTC
Date Wed, 11 Apr 2012 11:18:31 -0700
X-Received-Bytes 1997
Xref csiph.com comp.lang.java.programmer:13487

Show key headers only | View raw


On 4/11/12 4:56 AM, Maciej Labanowicz wrote:
> Hi,
>
> I'm trying to compile simple class, named Frame in package foo.bar:
>
> --[beg]--[Frame.java]-----------------------------------
> package foo.bar;
> import  java.awt.Frame;
> public class Frame extends java.awt.Frame {
>    public static final long serialVersionUID = 1L;
>    public static void main(String [] args) {
>      System.out.println("HELLO: args = " + args);
>    }
> }
> --[eof]--[Frame.java]-----------------------------------
As others have pointed out, the problem is that you import Frame.  you 
don't need to import something if you use the fully qualified name.

A side note, extending Frame is probably not what you really want to do. 
It is unfortunate that so many examples and tutorials have you do this, 
but in reality, you just need to compose a Frame with the various 
Components you need.  For the most part, the only time you need to 
extend *any* Component or JComponent is when you are creating a custom 
view of a specific type of data. And then you should only extend 
JComponent or Canvas as I understand it.


hth,
Daniel.

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


Thread

[foo.bar.Frame] can not inherit from [java.awt.Frame] Maciej Labanowicz <m.labanowicz@gmail.com> - 2012-04-11 04:56 -0700
  Re: can not inherit from [java.awt.Frame] Paul Cager <paul.cager@googlemail.com> - 2012-04-11 05:51 -0700
    Re: can not inherit from [java.awt.Frame] Lew <noone@lewscanon.com> - 2012-04-11 08:13 -0700
      Re: can not inherit from [java.awt.Frame] Paul Cager <paul.cager@googlemail.com> - 2012-04-11 09:37 -0700
  Re: [foo.bar.Frame] can not inherit from [java.awt.Frame] Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-04-11 12:59 +0000
  Re: [foo.bar.Frame] can not inherit from [java.awt.Frame] markspace <-@.> - 2012-04-11 08:24 -0700
    Re: [foo.bar.Frame] can not inherit from [java.awt.Frame] Patricia Shanahan <pats@acm.org> - 2012-04-11 09:34 -0700
      Re: [foo.bar.Frame] can not inherit from [java.awt.Frame] markspace <-@.> - 2012-04-11 10:01 -0700
  Re: [foo.bar.Frame] can not inherit from [java.awt.Frame] Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-04-11 11:18 -0700
    Re: [foo.bar.Frame] can not inherit from [java.awt.Frame] Lew <lewbloch@gmail.com> - 2012-04-11 12:18 -0700

csiph-web