Results 1 to 5 of 5

Thread: import java.swing.*; error - [SOLVED]

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member gjon's Avatar
    Join Date
    Nov 2004
    Location
    Inescapable Void
    Posts
    442

    import java.swing.*; error - [SOLVED]

    I get package java.swing does not exist. I am using BlueJ to test this sample and lo and behold it's not working for me. Is it not importing something correctly?

    Code:
    /* Wel.java
    An applet to illustrate the display of a string
    */
    import java.applet.*;
    import java.swing.*;
    import java.awt.*;
    
    public class Wel extends JApplet
    {
       // Create a content pane and a panel
       Container messageArea = getContentPane();
       MessagePanel myMessagePanel = new MessagePanel();
    
       // The init method adds the panel to the applet
       public void init()
       {
          messageArea.add( myMessagePanel );
       }
    }
    
    // The panel class on which the message is painted
    class MessagePanel extends JPanel
    {
       // The paintComponent method for this class
       public void paintComponent( Graphics grafObj )
       {
          grafObj.drawString( "Welcome to my home page!", 50, 50 );
       } 
    }
    Last edited by gjon; Oct 29th, 2005 at 10:05 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
  •  



Click Here to Expand Forum to Full Width