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 4 of 4

Thread: NEED HELP ASAP PLEASE

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default NEED HELP ASAP PLEASE

    I cannot figure out why my program will not run i feel retarted in net beans it keeps sayin no main class selected im lost please help if you can!!



    import java.awt.*;

    /**
    * Neonapplet.java for Logo and Name
    */
    public class NeonApplet extends java.applet.Applet implements Runnable
    {
    Thread blinker = null; // The thread that displays images
    String labelString; // The label for the window
    int delay; // the delay time between blinks
    public void init() {
    String blinkFrequency = getParameter("speed");
    delay = (blinkFrequency == null) ? 400 :
    (1000 / Integer.parseInt(blinkFrequency));
    labelString = getParameter("lbl");
    if (labelString == null)
    labelString = "Xcellent Computers";
    Font font = new java.awt.Font("Serif", Font.BOLD, 30);
    setFont(font);
    }

    public void paint(Graphics g) {
    int fontSize = g.getFont().getSize();
    int x = 200, y = fontSize, space;
    int red = (int)( 50 );
    int green = (int)( 50 );
    int blue = (int)(50);
    Dimension d = getSize();
    g.setColor(Color.black);
    FontMetrics fm = g.getFontMetrics();
    space = fm.stringWidth(" ");

    Graphics2D g2d = (Graphics2D)g;



    g.setColor(new java.awt.Color(0,10,255));
    g.drawString(labelString,50,50);

    g.setColor(new java.awt.Color(0,255,10));
    g2d.draw3DRect (80, 70, 80, 60,true);
    g2d.draw3DRect (90, 135, 60, 20,true);

    g2d.drawOval(155,140,10,15);



    try{
    Thread.currentThread().sleep(300);
    } catch (InterruptedException e) { }

    g.setColor(new java.awt.Color(255,255,10));
    g.drawString(labelString,50,50);

    g.setColor(new java.awt.Color(0,15,255));
    g2d.draw3DRect (80, 70, 80, 60,true);
    g2d.draw3DRect (90, 135, 60, 20,true);

    g2d.drawLine(90,80,150,120);
    g2d.drawLine(150,80,90,120);
    g2d.drawOval(155,140,10,15);
    }
    public void start() {
    blinker = new Thread(this);
    blinker.start();
    }
    public void stop() {
    blinker = null;
    }
    public void run() {
    Thread me = Thread.currentThread();
    while (blinker == me) {
    try {
    Thread.currentThread().sleep(delay);
    }
    catch (InterruptedException e) {
    }
    repaint();
    }
    }
    public String getAppletInfo() {
    return "Title: Blinker";
    }

    public String[][] getParameterInfo() {
    String pinfo[][] = {
    {"speed", "string", "The blink frequency"},
    {"lbl", "string", "The text to blink."},
    };
    return pinfo;
    }
    }
    Attached Files Attached Files


  2. #2
    Senile Half-Wit Freaky Chris's Avatar
    Join Date
    Mar 2009
    Posts
    834
    My Mood
    Cynical
    Thanks
    7
    Thanked 105 Times in 90 Posts

    Default Re: NEED HELP ASAP PLEASE

    I NEED BRAIN SURGERY ASAP!

    Run it as an applet not a Java program

  3. #3
    Junior Member
    Join Date
    Feb 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: NEED HELP ASAP PLEASE

    Ok soo im still lost can someone please help me ???

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

    Default Re: NEED HELP ASAP PLEASE

    What is the source of the code you posted? Is there a description there that tells you how to execute the code?

    Applets execute from an HTML page in a browser or in the AppletViewer.

    Read the tutorial on how to implement applets. Go to this site and Find applet:
    The Really Big Index

Similar Threads

  1. Need help!!! Asap PLEASE!!!!
    By choloboy in forum What's Wrong With My Code?
    Replies: 5
    Last Post: November 11th, 2011, 06:28 AM
  2. Need help ASAP!!!!
    By Swiper in forum What's Wrong With My Code?
    Replies: 9
    Last Post: August 12th, 2011, 06:41 PM
  3. GUI - calculate BMI (need help asap)
    By jahead in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 18th, 2011, 04:10 AM
  4. NEED HELP ASAP!!
    By JavaStudent_09 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: August 18th, 2010, 07:33 PM
  5. NEED HELP ASAP PLEASE!!!
    By mbm4ever in forum What's Wrong With My Code?
    Replies: 8
    Last Post: August 12th, 2010, 07:01 PM