|
package jtime;
import java.awt.*;
import java.util.*;
import javax.swing.*;
public class Main extends JFrame {
public Main() {
super("JTime");
this.setBounds(200, 20, 150, 150);
this. setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE);
hh. setForeground(Color. GREEN);
mm. setForeground(Color. GREEN);
ss. setForeground(Color. GREEN);
hh. setFont(new Font("Serif", Font. BOLD, 46 ));
mm. setFont(new Font("Serif", Font. BOLD, 46 ));
ss. setFont(new Font("Serif", Font. BOLD, 46 ));
p.add(hh);
p.add(mm);
p.add(ss);
p. setBackground(Color. BLACK);
TTest x = new TTest();
myTimer.schedule(x, 0, 1000);
this.getContentPane().add(p, "Center");
this.setResizable(false);
this.pack();
this.setVisible(true);
}
public TTest() {
super();
}
@Override
public void run() {
//throw new UnsupportedOperationException("Not supported yet.");
hh. setText(Integer. toString(h ) + " . ");
mm. setText(Integer. toString(m ) + " : ");
if (s == 0) {
ss. setText("6" + Integer. toString(s ));
} else if (s < 10) {
ss. setText("0" + Integer. toString(s ));
} else {
}
}
}
public static void main (String[] args ) {
Main f = new Main();
}
}
|
|