标题:NullPointerException异常,急求助!谢谢
取消只看楼主
yanmin0614
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2007-7-22
 问题点数:0 回复次数:1 
NullPointerException异常,急求助!谢谢

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,谢谢!

搜索更多相关主题的帖子: private public import super 
2007-10-12 22:04
yanmin0614
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2007-7-22
得分:0 
谢谢,谢谢二位仁兄.谢谢OPPLE,一语道破,茅塞顿开,谢谢啦.

2007-10-13 09:38



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-177159-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.056099 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved