Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2012
    Posts
    2
    Rep Power
    0

    Default Start: Applet not initialized

    HI im still learning how to use java, my code doesn't have any errors but it says it's not initialized can some look at it and see what i did wrong

    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;

    import javax.swing.JPanel;


    public class Person extends JPanel implements MouseListener

    {
    {


    this.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e) { if (turnsleft > 0)
    showNext();
    else reset();
    }});}


    private int turnsleft;


    public int getNumLeft() {
    return turnsleft;
    }

    public void reset(){
    turnsleft = 6;
    repaint();

    }

    public void showNext(){
    turnsleft = turnsleft -1;
    repaint();
    }


    public void init()
    {
    this.setSize(500, 400);
    }

    public void paintComponent(Graphics g){
    super.paintComponent(g);
    this.setBackground(Color.YELLOW);

    if (turnsleft < 1)
    {
    g.setColor(new Color(11, 56, 176));
    g.fillOval(250, 70, 40, 40);
    }


    if (turnsleft <2)
    {
    g.setColor(Color.BLUE);
    g.fillRect(190,100,125,125);
    }

    if (turnsleft <3)
    {
    g.setColor(Color.BLUE);
    g.fillRect(300,80,80,50);
    }

    if (turnsleft <4)
    {
    g.setColor(Color.BLUE);
    g.fillRect(125,80,80,50);
    }

    if (turnsleft <5)
    {
    g.setColor(Color.BLUE);
    g.fillRect(290,220,60,70);
    }

    if (turnsleft <6)
    {
    g.setColor(Color.BLUE);
    g.fillRect(155,220,60,70);
    }

    if (turnsleft <7)
    {
    g.setColor(Color.BLUE);
    g.fillRect(120,50,50,50);
    }

    if (turnsleft <8)
    {
    g.setColor(Color.BLUE);
    g.fillRect(335,50,50,50);
    }

    if (turnsleft <9)
    {
    g.setColor(Color.BLUE);
    g.fillRect(190,100,125,125);
    }

    if (turnsleft <10)
    {
    g.setColor(Color.BLUE);
    g.fillRect(150,260,67,30);
    }

    if (turnsleft <11)
    {
    g.setColor(Color.BLUE);
    g.fillRect(286,260,67,30);
    }
    }



    @Override
    public void mouseEntered(MouseEvent e) {
    // TODO Auto-generated method stub

    }

    @Override
    public void mouseExited(MouseEvent e) {
    // TODO Auto-generated method stub

    }

    @Override
    public void mousePressed(MouseEvent e) {
    // TODO Auto-generated method stub

    }

    @Override
    public void mouseReleased(MouseEvent e) {
    // TODO Auto-generated method stub

    }

    @Override
    public void mouseClicked(MouseEvent e) {
    // TODO Auto-generated method stub

    }

  2. #2
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default Re: Start: Applet not initialized

    Hello and welcome! Please use [code][/code] tags when posting code so we can easily read it!

    Forum Rules
    Guide For New Members
    BB Code List - Java Programming Forum

    What is the complete error message and what line does the error occur?

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,236
    Rep Power
    19

    Default Re: Start: Applet not initialized

    Moved from New to Java.

    Before you re-post your code using code tags, please learn how to format it according to the conventions: Code Conventions for the Java Programming Language: Contents

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. How to make this applet start a exe file?
    By gnoomen2 in forum Java Applets
    Replies: 1
    Last Post: 11-05-2012, 03:14 PM
  2. Variables might not have been initialized
    By tnixon22 in forum New To Java
    Replies: 5
    Last Post: 01-17-2011, 12:47 AM
  3. Applet won't start
    By David2010 in forum New To Java
    Replies: 5
    Last Post: 07-14-2009, 05:32 AM
  4. [SOLVED] &quot;start: applet not initialized&quot;
    By DenniGa in forum Java Applets
    Replies: 3
    Last Post: 02-24-2009, 02:10 AM
  5. how to start a Web Java applet without a webbrowser
    By racker79 in forum Java Applets
    Replies: 3
    Last Post: 09-22-2008, 06:30 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
  •