why couldn't execute this application?

Hi

I want to execute this application but the compiler says:

cannot resolve symbol

symbol : constructor Danger ( )

location: class Danger

Danger wa =new Danger( ) ;

why?

import java.awt.*;

import javax.swing.*;

publicclass Dangerextends JPanelimplements Runnable{

publicstaticvoid main(String args[]){

Danger wa =new Danger();

}

String text ="No text has been specified";

float hue = (float) 0.5;

float saturation = (float) 0.8;

float brightness = (float) 0.0;

Font textFont =new Font("Dialog", Font.BOLD, 20);

int textX;

Thread runner;

public Danger(String warning){

text = warning;

FontMetrics fm = getFontMetrics(textFont);

textX = 200 - fm.stringWidth(text) / 2;

runner =new Thread(this);

runner.start();

}

publicvoid paintComponent(Graphics comp){

Graphics2D comp2D = (Graphics2D) comp;

comp2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING,

RenderingHints.VALUE_ANTIALIAS_ON);

comp2D.setColor(Color.black);

comp2D.fillRect(0, 0, 400, 200);

Color textColor = Color.getHSBColor(hue, saturation,

brightness);

comp2D.setColor(textColor);

comp2D.setFont(textFont);

comp2D.drawString(text, textX, 30);

}

void pause(int duration){

try{

Thread.sleep(duration);

}catch (InterruptedException e){

// do nothing

}

}

publicvoid run(){

Thread thisThread = Thread.currentThread();

while (runner == thisThread){

pause(75);

brightness += 0.05;

if (brightness > 1){

brightness = (float) 0.0;

pause(75);

}

repaint();

}

}

}

[3478 byte] By [vanpersiea] at [2007-11-27 11:04:15]
# 1

You have no trouble at all executing it because it won't compile into an executable in the first place!

Your class Danger has no empty constructor, but in the main method you are trying to use that constructor anyway

georgemca at 2007-7-29 12:56:52 > top of Java-index,Java Essentials,New To Java...
# 2

Since you defined a constructor with one argument

public Danger(String warning)

java will not provide you the default constructor. If you still want to use that way you can just add no argument constructor.

public Danger() {}

prassoona at 2007-7-29 12:56:52 > top of Java-index,Java Essentials,New To Java...