Results 1 to 3 of 3

Thread: Frame problems

  1. #1
    gary is offline Member
    Join Date
    Jun 2007
    Posts
    8
    Rep Power
    0

    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

    Java 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 12:06 PM.

  2. #2
    levent Guest

    Default

    Hi Gary,

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

    Java 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;
         }
    }

  3. #3
    gary is offline Member
    Join Date
    Jun 2007
    Posts
    8
    Rep Power
    0

Similar Threads

  1. close a frame..
    By tajinvillage in forum New To Java
    Replies: 5
    Last Post: 04-27-2008, 10:22 PM
  2. Sending output to a Frame
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 02-04-2008, 09:28 AM
  3. Hiding the frameís title bar
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-21-2007, 08:41 AM
  4. Resize frame
    By lenny in forum AWT / Swing
    Replies: 1
    Last Post: 07-29-2007, 11:18 PM
  5. Frame Query
    By Daniel in forum AWT / Swing
    Replies: 1
    Last Post: 07-05-2007, 06:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •