Applet中的NullPointerException [英] NullPointerException in Applet

查看:83
本文介绍了Applet中的NullPointerException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


提前致谢我是Java新手。目前我有两个java文件,一个是applet。当我尝试预览小程序时,我收到如下错误:


java.lang.NullPointerException

at java.util.Hashtable.put(Unknown Source )

在javax.swing.JEditorPane.registerEditorKitForConten tType(未知来源)

在javax.swing.JEditorPane.registerEditorKitForConten tType(未知来源)

在javax.swing.JEditorPane.loadDefaultKitsIfNecessary(未知来源)

在javax.swing.JEditorPane.getKitTypeRegistry(未知来源)

在javax.swing.JEditorPane.getEditorKitClassNameForCo ntentType (未知来源)

在javax.swing.JTextPane。< init>(未知来源)


我做错了什么?请帮助我伙计们......谢谢

解决方案

你能展示一些(相关的)代码吗?顺便说一下,我把你的话题发表了标题

更多的东西。


亲切的问候,


Jos


因为您指向没有密钥的哈希表?


检查使用该哈希表的代码...

大家好,


谢谢Josah。嗯,你是什么意思哈希表?我不明白..Sorry.btw这是我的代码,调用JTextPane


代码:


private JTextArea textArea = null;

private JTextPane resultArea = null;

private JComboBox langBox = null;


私人地图< Language,ConfigurationDialog> configDialogs = new HashMap< Language,ConfigurationDialog>();

public void createAndShowGUI(String inputText){

JFrame frame = new JFrame(" Test");

frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOS E);


textArea = new JTextArea(inputText);

// TODO:错误行对于自动换行的行显示数字:

textArea.setLineWrap(true);

textArea.setWrapStyleWord(true);

resultArea = new JTextPane();

resultArea.setContentType(" text / html");

resultArea.setText(" Results will here here");

JLabel label = new JLabel(请键入或粘贴文本以检查顶部区域);

JButton button = new JButton(" Check text) ;

button.setMnemonic(''c'');

button.addActionListener(this);


Hi all,

Thanks in advance. I am new at Java. Currently I''m having two java files one is applet. when i try to preview the applet i get an error like this :

java.lang.NullPointerException
at java.util.Hashtable.put(Unknown Source)
at javax.swing.JEditorPane.registerEditorKitForConten tType(Unknown Source)
at javax.swing.JEditorPane.registerEditorKitForConten tType(Unknown Source)
at javax.swing.JEditorPane.loadDefaultKitsIfNecessary (Unknown Source)
at javax.swing.JEditorPane.getKitTypeRegistry(Unknown Source)
at javax.swing.JEditorPane.getEditorKitClassNameForCo ntentType(Unknown Source)
at javax.swing.JTextPane.<init>(Unknown Source)

what i''m doing wrong?pls help me guys...thanks

解决方案

Can you show a bit of (relevant) code please? btw, I changed your topic titile
to something more to the point.

kind regards,

Jos


because you pointed to hashtable that doesn''t have the key ?

check your code that use that hashtable ...


Hi all,

Thanks Josah. Erm, what do you mean by hashtable nick?I don''t understand..Sorry.btw this is my code that call JTextPane

code :

private JTextArea textArea = null;
private JTextPane resultArea = null;
private JComboBox langBox = null;

private Map<Language, ConfigurationDialog> configDialogs = new HashMap<Language, ConfigurationDialog>();
public void createAndShowGUI(String inputText) {
JFrame frame = new JFrame("Test");
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOS E);

textArea = new JTextArea(inputText);
// TODO: wrong line number is displayed for lines that are wrapped automatically:
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
resultArea = new JTextPane();
resultArea.setContentType("text/html");
resultArea.setText("Results will appear here");
JLabel label = new JLabel("Please type or paste text to check in the top area");
JButton button = new JButton("Check text");
button.setMnemonic(''c'');
button.addActionListener(this);


这篇关于Applet中的NullPointerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆