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();
}
}
}

