import java.text.DateFormat;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.JOptionPane;
public class myTime extends JFrame
{
private JTextArea timeOutput;
private DateFormat currentTime;
public myTime()
{
super( "Clock" );
Container mycontainer = getContentPane();
mycontainer.setLayout( new FlowLayout() );
timeOutput = new JTextArea();
mycontainer.add( timeOutput );
//currentTime = new DateFormat();
currentTime.getTimeInstance();
String output = "";
output += currentTime.toString();/////////此处异常
timeOutput.setText( output );
JOptionPane.showMessageDialog( null, output, "Time", JOptionPane.INFORMATION_MESSAGE );
setSize( 300, 300 );
setVisible( true );
}
public static void main( String args[] )
{
myTime mytime = new myTime();//////////此处异常
mytime.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}
}
大家帮帮忙,可直接联系yanmin0614@163.com,谢谢!