Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-20-2007, 12:59 PM
Member
 
Join Date: Jun 2007
Posts: 8
Rep Power: 0
gary is on a distinguished road
Default Frame problems
Hello again
I may be doing something stupid but here is my problem

when I create frames I normally use two classes
the main class which creates the frame and calls all componenets

I am trying to do this all in one file but with no luck

the code I am using is

Code:
import java.awt.*;

public class myclass
{
     public myclass()
     {
          // all the gui components
     }

     public static void main(String[] args)
     {
          Frame frame = new myclass();
          frame.show;
     }
}
But I get the error Incompatable type for declaration cant convert myclass to java.awt.Frame
Please help
Gary

Last edited by levent; 06-20-2007 at 01:06 PM.
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 06-20-2007, 01:07 PM
levent
Guest
 
Posts: n/a
Default
Hi Gary,

It seems that you forget to extend Frame class. Try this one:

Code:
import java.awt.*;

public class myclass extends Frame
{
     public myclass()
     {
          // all the gui components
     }

     public static void main(String[] args)
     {
          Frame frame = new myclass();
          frame.show;
     }
}
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-20-2007, 02:21 PM
Member
 
Join Date: Jun 2007
Posts: 8
Rep Power: 0
gary is on a distinguished road
Default Duh
Thanks, I new it would be something simple.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
close a frame.. tajinvillage New To Java 5 04-27-2008 11:22 PM
Sending output to a Frame Java Tip Java Tips 0 02-04-2008 10:28 AM
Hiding the frame’s title bar Java Tip Java Tips 0 12-21-2007 09:41 AM
Resize frame lenny AWT / Swing 1 07-30-2007 12:18 AM
Frame Query Daniel AWT / Swing 1 07-05-2007 07:27 PM


All times are GMT +2. The time now is 06:30 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org