Results 1 to 5 of 5

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

  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.

  2. #2

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

    Re: import java.swing.*; error

    Got it, it's javax.swing. Thanks for looking.

  3. #3
    Lively Member
    Join Date
    Oct 2005
    Posts
    74

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

    Bluej sucks! One of my online classes is 'teaching' me Java using BlueJ. His instrcutions suck, he won't answer questions and he dislikes me because I informed him of his falure to provide adequet instruction. His reply was, "The poor instructions are not my fault, KVHS purchased them from Florida." Why would you purchase a class for programming from Florida, they can't even count!

    Excuse my rant
    Vagabon

  4. #4
    Fanatic Member x-ice's Avatar
    Join Date
    Mar 2004
    Location
    UK
    Posts
    671

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

    Quote Originally Posted by vagabon
    Bluej sucks! One of my online classes is 'teaching' me Java using BlueJ. His instrcutions suck, he won't answer questions and he dislikes me because I informed him of his falure to provide adequet instruction. His reply was, "The poor instructions are not my fault, KVHS purchased them from Florida." Why would you purchase a class for programming from Florida, they can't even count!

    Excuse my rant
    Vagabon
    So you dont like BlueJ because you have a rubbish instructor? If you are taught to programme using BlueJ by a good teacher then BlueJ is amazing. I am learning Java with BlueJ and i think is great, but only for beginners.

  5. #5

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

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

    i agree with vagabon, i dislike bluej very much. I think that any class that will teach java to students should be using Java Studio Creator 2 which has an environment like visual studio. Makes learning the language a lot easier.
    If you're gonna take a class, I recommend you telling your instructor to get a hold of that program over any other for using to learn java.

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