Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: Does MessagePanel class/ component exist in Java awt/ swing?

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    9
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Does MessagePanel class/ component exist in Java awt/ swing?

    Hello, there I am quite new to Java programming and am currently working on JApplet in Java. Just wondering that is there any MessagePanel class/component (something similar to JPanel class)in java awt/ swing because when I tried to instantiate this statement -->MessagePanel inputPanel=new MessagePanel(); inside my IDE. It seems that the compiler is underlining the MessagaPanel as an error. Greatly appreciate anyone who help to provide me some guidelines on this.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Does MessagePanel class/ component exist in Java awt/ swing?

    MessagePanel is not a standard Java component. JPanel and JApplet both are.

    If you have a MessagePanel class, you're going to have to post an SSCCE that demonstrates what you're trying to do.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. The Following User Says Thank You to KevinWorkman For This Useful Post:

    bryanOnInternet (December 20th, 2012)

  4. #3
    Junior Member
    Join Date
    Dec 2012
    Posts
    9
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: Does MessagePanel class/ component exist in Java awt/ swing?

    /*
    * It displays a message at certain location (x,y) in which both message and location is obtained from a HTML source
    */
    import java.awt.*;
    import javax.swing.*;
    import java.awt.Font;
    import java.awt.BorderLayout;

    public class DisplayMessage extends JApplet {


    public void init(){
    String message=getParameter("inputMessage");
    int x=Integer.parseInt(getParameter("X"));
    int y=Integer.parseInt(getParameter("Y"));

    MessagePanel inputPanel=new MessagePanel();
    inputPanel.setXCoordinate(x);
    inputPanel.setYCoordinate(y);

    Container contentPane = getContentPane();
    contentPane.add(inputPanel);
    }
    }
    hello there, this is the code.

  5. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Does MessagePanel class/ component exist in Java awt/ swing?

    Where have you seen the MessagePanel class? Did you look in the API doc for the Java SE classes?
    Java Platform SE 7
    If you don't understand my answer, don't ignore it, ask a question.

  6. The Following User Says Thank You to Norm For This Useful Post:

    bryanOnInternet (December 20th, 2012)

  7. #5
    Junior Member
    Join Date
    Dec 2012
    Posts
    9
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: Does MessagePanel class/ component exist in Java awt/ swing?

    I got it from a reference book in which I am trying to learn Java from. Yeap, I looked for the messagePanel in the API doc, but it seems that I couldn't find it.

  8. #6
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: Does MessagePanel class/ component exist in Java awt/ swing?

    Chances are MessagePanel is defined somewhere else in the book, or it's just an example. It's not a standard Java class.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  9. The Following User Says Thank You to KevinWorkman For This Useful Post:

    bryanOnInternet (December 21st, 2012)

  10. #7
    Junior Member
    Join Date
    Dec 2012
    Posts
    9
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default Re: Does MessagePanel class/ component exist in Java awt/ swing?

    got it. really thanks for your help, kevin

Similar Threads

  1. OpenGL with Swing/AWT/ whatever Java gui
    By Lablabla in forum AWT / Java Swing
    Replies: 1
    Last Post: May 4th, 2012, 09:15 AM
  2. IE browser in Java swing/AWT Frame
    By gafaec in forum AWT / Java Swing
    Replies: 0
    Last Post: April 10th, 2011, 05:16 AM
  3. IE browser in Java swing/AWT Frame
    By gafaec in forum Java Native Interface
    Replies: 0
    Last Post: April 9th, 2011, 05:16 AM
  4. How to Use the JList component - Java Swing
    By neo_2010 in forum Java Swing Tutorials
    Replies: 1
    Last Post: July 11th, 2009, 04:02 AM
  5. How to Use the JList component - Java Swing
    By neo_2010 in forum Java Code Snippets and Tutorials
    Replies: 1
    Last Post: July 11th, 2009, 04:02 AM