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!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: [foo.bar.Frame] can not inherit from [java.awt.Frame] Date: Wed, 11 Apr 2012 12:18:06 -0700 (PDT) Organization: http://groups.google.com Lines: 30 Message-ID: <25298982.124.1334171886562.JavaMail.geo-discussion-forums@pbje9> References: <8d7bedc4-30a8-4dc4-97b6-9ddaafc2e16a@l4g2000vbt.googlegroups.com> NNTP-Posting-Host: 69.28.149.29 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1334171887 26876 127.0.0.1 (11 Apr 2012 19:18:07 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 11 Apr 2012 19:18:07 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Received-Bytes: 2352 Xref: csiph.com comp.lang.java.programmer:13488 Daniel Pitts wrote: > Maciej Labanowicz wrote: >> 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. This raises another question, OP: Why do you use 'java.awt.Frame' instead of 'javax.swing.JFrame'? -- Lew