[問題] 關於JAVA的util套件
各位學長姊好
在下在練習作業的時候出了一點小trouble
情況如下
我在自己的電腦會無法找到util的方法
導致無法順利compile 檔案
但是傳給其他同學測試就ok 而且也可以正常執行
JDK也重灌過
但仍是無法解決
希望可以幫忙解答一下
感謝大家^^
--
附上程式碼
import java.awt.*;
import javax.swing.*;
import java.util.*;
import java.text.*;
public class ClockThread implements Runnable{
Thread t ;
JLabel l ;
public ClockThread(){
JFrame f = new JFrame("test");
f.setBounds(150,250,150,100);
f.setLayout(new BorderLayout());
l = new JLabel();
l.setFont(new Font("",Font.BOLD,30));
f.add(l,"Center");
f.setVisible(true);
t = new Thread(this);
t.start();
}
public void run(){
while(true){
try{
System.out.print("1");
l.setText(getTime());
Thread.sleep(1000);
}catch(InterruptedException e){}
}
}
public String getTime(){
String a;
Calendar c = Calendar.getInstance();
int n = c.get(Calendar.AM_PM);
if(n==0)
a = " AM" ;
else
a = " PM" ;
return
c.get(Calendar.HOUR)+":"+c.get(Calendar.MINUTE)+":"+c.get(Calendar.SECOND)
+""+a;
}
public static void main(String[] args){
new ClockThread();
}
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.115.236.21
推
11/17 21:22, , 1F
11/17 21:22, 1F
推
11/18 01:39, , 2F
11/18 01:39, 2F
→
11/18 09:50, , 3F
11/18 09:50, 3F
→
11/18 14:37, , 4F
11/18 14:37, 4F