📄 watch.java
字号:
/* * Watch.java * * Created on 2004年9月24日, 下午7:17 *//** * * @author litertiger */import java.awt.*;import java.util.*;public class Watch extends javax.swing.JApplet { private Color butterscotch=new Color(255,204,102); private String lastTime=""; /** Initializes the applet Watch */ public void init() { setBackground(Color.BLACK); initComponents(); } /** This method is called from within the init() method to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ public void paint(Graphics screen) { Graphics2D screen2D=( Graphics2D)screen; //这里是用原来定义的 //Graphics2D是一个定义 Font type=new Font("Monospaced",Font.BOLD,20); screen2D.setFont(type); GregorianCalendar day=new GregorianCalendar(); String time=day.getTime().toString(); screen2D.setColor(Color.BLACK); screen2D.drawString(lastTime,5,25); screen2D.setColor(butterscotch); screen2D.drawString(time,5,25); try{ Thread.sleep(1000); } catch(InterruptedException e) { } lastTime=time; repaint(); } private void initComponents() {//GEN-BEGIN:initComponents }//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -