老师留的作业打写一个程序运行这个程序的时候可以显示当前时间。怎么能让我写的这两个类和在一起实现呢。或者需要加些什么东西呢 希望各位高手指点一下。小可感激不尽。端午快到了。希望看到本帖的人。合家欢乐。天天健康。
package hoemwork05;import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;import javax.swing.JFrame;
import javax.swing.JTable;public class TestHome05 {
public static void main(String args[])throws IOException{
File file=new File("D:\\2bqq");
long fTime=file.lastModified();
Date date=new Date(fTime);
SimpleDateFormat sdf=new SimpleDateFormat("yyyy年MM月dd日 hh:mm:ss");
String str=sdf.format(date);
System.out.println(str);
}
}
//=================================================================================================package hoemwork05;import javax.swing.JFrame;public class Test1 extends JFrame{
public Test1(){
this.setTitle("Time");
this.setBounds(100, 100, 200, 200);
}
public static void main(String args[]){
new Test1().setVisible(true);
}
}
package hoemwork05;import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;import javax.swing.JFrame;
import javax.swing.JTable;public class TestHome05 {
public static void main(String args[])throws IOException{
File file=new File("D:\\2bqq");
long fTime=file.lastModified();
Date date=new Date(fTime);
SimpleDateFormat sdf=new SimpleDateFormat("yyyy年MM月dd日 hh:mm:ss");
String str=sdf.format(date);
System.out.println(str);
}
}
//=================================================================================================package hoemwork05;import javax.swing.JFrame;public class Test1 extends JFrame{
public Test1(){
this.setTitle("Time");
this.setBounds(100, 100, 200, 200);
}
public static void main(String args[]){
new Test1().setVisible(true);
}
}
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JFrame;public class TestHome05 { public static void main(String args[]) throws IOException { File file = new File("2bqq");
long fTime = file.lastModified();
Date date = new Date(fTime);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 hh:mm:ss");
String str = sdf.format(date);
System.out.println(str);
JFrame jframe = new JFrame();
jframe.setTitle(str);
jframe.setBounds(100, 100, 200, 200);
jframe.setVisible(true);
}
}
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;public class Test1 extends JFrame{
public Test1(){
File file=new File("D:\\2bqq");
long fTime=file.lastModified();
Date date=new Date(fTime);
SimpleDateFormat sdf=new SimpleDateFormat("yyyy年MM月dd日 hh:mm:ss");
String str=sdf.format(date);this.setTitle("Time");
this.setBounds(100, 100, 200, 200);
JLabel jlabel = new JLabel();
add(jlabel);
jlabel.setText(str);
}
public static void main(String args[]){
new Test1().setVisible(true);
}
}
楼上好快
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JFrame;public class TestHome05 { public static void main(String args[]) throws IOException { File file = new File("2bqq");
long fTime = file.lastModified();
Date date = new Date(fTime);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 hh:mm:ss");
String str = sdf.format(date);
System.out.println(str);
JFrame jframe = new JFrame();
jframe.setTitle(str);
jframe.setBounds(100, 100, 200, 200);
jframe.setVisible(true);
}
}
你是想写什么呀。
用图片吧
图片做起来,美点。