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




Reply With Quote