📄 viruswarning.java
字号:
import java.awt.*;
import java.awt.event.*;
class VirusWarning extends Frame {
/* The Graphic warning Program by J M Bishop Oct 1996
* Java 1.1 by T Abbott Oct 1997
* updated 1.2 by J Bishop May 2000
* produces a warning message on the screen in cyan
* and black.
* Illustrates setting up a window, painting in it
* and enabling the close box.
*/
VirusWarning () {
setTitle("Draw Warning");
setSize(220,150);
setBackground(Color.cyan);
setForeground(Color.black);
addWindowListener(new WindowAdapter () {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
setVisible(true);
}
public void paint(Graphics g) {
g.setColor(Color.pink);
g.fillRect(25, 30, 150, 90);
g.setColor(Color.black);
g.drawString("W A R N I N G", 70, 60);
g.drawString("Possible virus detected", 45, 75);
g.drawString("Reboot and run virus", 50, 90);
g.drawString("remover software", 60, 105);
}
public static void main(String[] args) {
new VirusWarning ();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -