473,410 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

NullPointerException in Applet

37
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
Aug 15 '07 #1
21 4007
JosAH
11,448 Expert 8TB
Can you show a bit of (relevant) code please? btw, I changed your topic titile
to something more to the point.

kind regards,

Jos
Aug 15 '07 #2
nickyeng
254 100+
because you pointed to hashtable that doesn't have the key ?

check your code that use that hashtable ...
Aug 15 '07 #3
teenIce
37
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);
Aug 15 '07 #4
r035198x
13,262 8TB
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);
1.) Please use code tags when posting code.
2.) If you look at that stacktrace again, you'll see that it tells you the exact line number where that exception was thrown. That line and the code lines around it are the relevant code that Jos asked you to post.
Aug 15 '07 #5
teenIce
37
oh...thanks guys,

ok...here is the code that is relevant to the trace and the full trace

trace :

Expand|Select|Wrap|Line Numbers
  1.  
  2. Java Plug-in 1.6.0_02
  3. Using JRE version 1.6.0_02 Java HotSpot(TM) Client VM
  4. User home directory = C:\Documents and Settings\Administrator
  5. network: Loading user-defined proxy configuration ...
  6. network: Done.
  7. network: Loading proxy configuration from Internet Explorer ...
  8. network: Done.
  9. network: Loading direct proxy configuration ...
  10. network: Done.
  11. network: Proxy Configuration: No proxy
  12.  
  13.  
  14. ----------------------------------------------------
  15. c:   clear console window
  16. f:   finalize objects on finalization queue
  17. g:   garbage collect
  18. h:   display this help message
  19. l:   dump classloader list
  20. m:   print memory usage
  21. o:   trigger logging
  22. p:   reload proxy configuration
  23. q:   hide console
  24. r:   reload policy configuration
  25. s:   dump system and deployment properties
  26. t:   dump thread list
  27. v:   dump thread stack
  28. x:   clear classloader cache
  29. 0-5: set trace level to <n>
  30. ----------------------------------------------------
  31.  
  32. liveconnect: Invoking JS method: document
  33. liveconnect: Invoking JS method: URL
  34. basic: Referencing classloader: sun.plugin.ClassLoaderInfo@12498b5, refcount=1
  35. basic: Added progress listener: sun.plugin.util.GrayBoxPainter@f5da06
  36. basic: Loading applet ...
  37. basic: Initializing applet ...
  38. basic: Starting applet ...
  39. basic: completed perf rollup
  40. liveconnect: Invoking method: public void test.check(java.lang.String)
  41. liveconnect: Needs conversion: java.lang.String --> java.lang.String
  42. java.lang.NullPointerException
  43.     at java.util.Hashtable.put(Unknown Source)
  44.     at javax.swing.JEditorPane.registerEditorKitForContentType(Unknown Source)
  45.     at javax.swing.JEditorPane.registerEditorKitForContentType(Unknown Source)
  46.     at javax.swing.JEditorPane.loadDefaultKitsIfNecessary(Unknown Source)
  47.     at javax.swing.JEditorPane.getKitTypeRegistry(Unknown Source)
  48.     at javax.swing.JEditorPane.getEditorKitClassNameForContentType(Unknown Source)
  49.     at javax.swing.JTextPane.<init>(Unknown Source)
  50.     at mypack.Main.createAndShowGUI(main.java:84)
  51.     at mypack.Main.openGui(main.java:236)
  52.     at test.check(test.java:27)
  53.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  54.     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  55.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  56.     at java.lang.reflect.Method.invoke(Unknown Source)
  57.     at sun.plugin.javascript.JSInvoke.invoke(Unknown Source)
  58.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  59.     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  60.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  61.     at java.lang.reflect.Method.invoke(Unknown Source)
  62.     at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
  63.     at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
  64.     at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
  65.     at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
  66.     at java.security.AccessController.doPrivileged(Native Method)
  67.     at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
  68. java.lang.Exception: java.lang.NullPointerException
  69.     at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
  70.     at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
  71.     at java.security.AccessController.doPrivileged(Native Method)
  72.     at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
  73.  
  74.  

and the relevant code is :

Expand|Select|Wrap|Line Numbers
  1. private JTextArea textArea = null;
  2.   private JTextPane resultArea = null;
  3.   private JComboBox langBox = null;
  4.  
  5.   private Map<Language, ConfigurationDialog> configDialogs = new HashMap<Language, ConfigurationDialog>();
  6.  
  7.    public Main() {
  8.   }
  9.  
  10.   public void createAndShowGUI(String inputText) {
  11.     JFrame frame = new JFrame("Grammar Check Tool");
  12.     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  13.  
  14.     textArea = new JTextArea(inputText);
  15.     // TODO: wrong line number is displayed for lines that are wrapped automatically:
  16.     textArea.setLineWrap(true);
  17.     textArea.setWrapStyleWord(true);
  18.      JTextPane resultArea = new JTextPane();
  19.     resultArea.setContentType("text/html");
  20.     resultArea.setText("Results will appear here");   
  21.     JLabel label = new JLabel("Please type or paste text to check in the top area");
  22.     JButton button = new JButton("Check text");
  23.     button.setMnemonic('c'); 
  24.     button.addActionListener(this);
  25.  
  26.     JButton configButton = new JButton(OPTIONS_BUTTON);
  27.     configButton.setMnemonic('o'); 
  28.     configButton.addActionListener(this);
  29.  
  30.     JPanel panel = new JPanel();
  31.     panel.setLayout(new GridBagLayout());
  32.     GridBagConstraints buttonCons = new GridBagConstraints();
  33.     buttonCons.gridx = 0;
  34.     buttonCons.gridy = 0;
  35.     panel.add(button, buttonCons);
  36.     buttonCons.gridx = 1;
  37.     buttonCons.gridy = 0;
  38.     panel.add(new JLabel("  "), buttonCons);
  39.     buttonCons.gridx = 2;
  40.     buttonCons.gridy = 0;
  41.  
  42.     buttonCons.gridx = 3;
  43.     buttonCons.gridy = 0;
  44.     buttonCons.insets = new Insets(0, 10, 0, 0);
  45.     //panel.add(configButton, buttonCons);
  46.  
  47.     Container contentPane = frame.getContentPane();
  48.     GridBagLayout gridLayout = new GridBagLayout();
  49.     contentPane.setLayout(gridLayout);
  50.     GridBagConstraints cons = new GridBagConstraints();
  51.     cons.fill = GridBagConstraints.BOTH;
  52.     cons.weightx = 10.0f;
  53.     cons.weighty = 10.0f;
  54.     cons.gridx = 0;
  55.     cons.gridy = 0;
  56.     contentPane.add(new JScrollPane(textArea), cons);
  57.     cons.gridy = 1;
  58.     cons.weighty = 5.0f;
  59.     contentPane.add(new JScrollPane(resultArea), cons);
  60.  
  61.     cons.fill = GridBagConstraints.NONE;
  62.     cons.gridx = 0;
  63.     cons.gridy = 2;
  64.     cons.weighty = 0.0f;
  65.     cons.insets = new Insets(3,3,3,3);
  66.     //cons.fill = GridBagConstraints.NONE;
  67.     contentPane.add(label, cons);
  68.     cons.gridy = 3;
  69.     contentPane.add(panel, cons);
  70.  
  71.     frame.pack();
  72.     frame.setSize(600, 600);
  73.     frame.setVisible(true);
  74.   }
  75.  
  76.  
Thanks for your help...
Aug 15 '07 #6
JosAH
11,448 Expert 8TB
Which of the lines is line #84 in method createAndShowGUI()?

kind regards,

Jos
Aug 15 '07 #7
teenIce
37
Which of the lines is line #84 in method createAndShowGUI()?

kind regards,

Jos

resultArea = new JTextPane();

regards,
teenICe
Aug 15 '07 #8
r035198x
13,262 8TB
Here is one nit that is a good recipe for brewing nullpointers.

You have
Expand|Select|Wrap|Line Numbers
  1.  JTextPane resultArea = new JTextPane();
inside your createGUI method. This hides the resultArea already defined in the class using
Expand|Select|Wrap|Line Numbers
  1. private JTextPane resultArea = null;
. The later resultArea variable is thus probably not being initialized properly.
Aug 15 '07 #9
JosAH
11,448 Expert 8TB
resultArea = new JTextPane();

regards,
teenICe
Got it: you have a member variable resultArea but you also define a local variable
with the same name; it effectively hides the member variable which will remain
null all the time. Don't define that local variable.

kind regards,

Jos
Aug 15 '07 #10
r035198x
13,262 8TB
resultArea = new JTextPane();

regards,
teenICe
Something is rotten in the state of Denmark here ...
Aug 15 '07 #11
teenIce
37
so..its means I must comment out this code :

Expand|Select|Wrap|Line Numbers
  1.  private JTextPane resultArea = null;
thanks guys...
I'll try it... :)
Aug 15 '07 #12
r035198x
13,262 8TB
so..its means I must comment out this code :

Expand|Select|Wrap|Line Numbers
  1.  private JTextPane resultArea = null;
thanks guys...
I'll try it... :)
That's not what Jos said. Read it again. Just don't define a new variable for it in your method.

@Jos, why would he get a nullpointer at that line? I'd expect the nullpointer to occur somewhere else, most likely outside the createGUI method.
Aug 15 '07 #13
teenIce
37
No...I try to comment out the code but still have same error...I don't know what I'm doing wrong.Hmm...maybe I'm not understand enough.Can you guys explain it to me??Please...

Thanks in advance..
Aug 15 '07 #14
r035198x
13,262 8TB
No...I try to comment out the code but still have same error...I don't know what I'm doing wrong.Hmm...maybe I'm not understand enough.Can you guys explain it to me??Please...

Thanks in advance..
Read the responses again. Commenting out lines of code that give errors does not neccessarily remove the errors.
In your method, you have
Expand|Select|Wrap|Line Numbers
  1. JTextPane resultArea = new JTextPane();
Just change that to
Expand|Select|Wrap|Line Numbers
  1.  resultArea = new JTextPane();
like you did with that text area.
Aug 15 '07 #15
JosAH
11,448 Expert 8TB
@Jos, why would he get a nullpointer at that line? I'd expect the nullpointer to occur somewhere else, most likely outside the createGUI method.
I don't know but I suspect the code is different from what we see here. A different
version mayhap ... that local variable definitely is a nono.

kind regards,

Jos
Aug 15 '07 #16
JosAH
11,448 Expert 8TB
Commenting out lines of code that give errors does not neccessarily remove the errors.
That's the good ol' "amputation strategy". The old Romans already did that:
does your leg hurt? *Chop!* now it doesn't hurt anymore.

Nowadays people sometimes mistake Occam's Razor for the "amputation strategy" ;-)

kind regards,

Jos
Aug 15 '07 #17
teenIce
37
I had try both of the method and still it give error.Let me explain what I'm trying to do and sorry if I had you guys confuse with my code.. :). The code that I copy just now is from open source code and it is create a gui for the application. The code is already a GUI so I create an applet to access the function that create the GUI and launch it using an applet so I can pass my parameters to certain function in the main code.

Now I'll paste the main code that create gui

Expand|Select|Wrap|Line Numbers
  1.  
  2. public class Main  implements ActionListener {
  3.  
  4.   private static final String OPTIONS_BUTTON = "Options...";
  5.  
  6.   private JTextArea textArea = null;
  7.   private JTextPane resultArea = null;
  8.   private JComboBox langBox = null;
  9.  
  10.   private Map<Language, ConfigurationDialog> configDialogs = new HashMap<Language, ConfigurationDialog>();
  11.  
  12.    public Main() {
  13.   }
  14.  
  15.   public void createAndShowGUI(String inputText) {
  16.     JFrame frame = new JFrame("Grammar Check Tool");
  17.     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  18.  
  19.     textArea = new JTextArea(inputText);
  20.     // TODO: wrong line number is displayed for lines that are wrapped automatically:
  21.     textArea.setLineWrap(true);
  22.     textArea.setWrapStyleWord(true);
  23.     resultArea = new JTextPane();
  24.     resultArea.setContentType("text/html");
  25.     resultArea.setText("Results will appear here");
  26.     JLabel label = new JLabel("Please type or paste text to check in the top area");
  27.     JButton button = new JButton("Check text");
  28.     button.setMnemonic('c'); 
  29.     button.addActionListener(this);
  30.  
  31.     JButton configButton = new JButton(OPTIONS_BUTTON);
  32.     configButton.setMnemonic('o'); 
  33.     configButton.addActionListener(this);
  34.  
  35.     JPanel panel = new JPanel();
  36.     panel.setLayout(new GridBagLayout());
  37.     GridBagConstraints buttonCons = new GridBagConstraints();
  38.     buttonCons.gridx = 0;
  39.     buttonCons.gridy = 0;
  40.     panel.add(button, buttonCons);
  41.     buttonCons.gridx = 1;
  42.     buttonCons.gridy = 0;
  43.     panel.add(new JLabel("  "), buttonCons);
  44.     buttonCons.gridx = 2;
  45.     buttonCons.gridy = 0;
  46.     langBox = new JComboBox();
  47.      /*for (Language lang : Language.LANGUAGES) {
  48.       if (lang != Language.DEMO) {
  49.         langBox.addItem(lang);
  50.       }
  51.     }*/
  52.     //panel.add(langBox, buttonCons);
  53.     buttonCons.gridx = 3;
  54.     buttonCons.gridy = 0;
  55.     buttonCons.insets = new Insets(0, 10, 0, 0);
  56.     //panel.add(configButton, buttonCons);
  57.  
  58.     Container contentPane = frame.getContentPane();
  59.     GridBagLayout gridLayout = new GridBagLayout();
  60.     contentPane.setLayout(gridLayout);
  61.     GridBagConstraints cons = new GridBagConstraints();
  62.     cons.fill = GridBagConstraints.BOTH;
  63.     cons.weightx = 10.0f;
  64.     cons.weighty = 10.0f;
  65.     cons.gridx = 0;
  66.     cons.gridy = 0;
  67.     contentPane.add(new JScrollPane(textArea), cons);
  68.     cons.gridy = 1;
  69.     cons.weighty = 5.0f;
  70.     contentPane.add(new JScrollPane(resultArea), cons);
  71.  
  72.     cons.fill = GridBagConstraints.NONE;
  73.     cons.gridx = 0;
  74.     cons.gridy = 2;
  75.     cons.weighty = 0.0f;
  76.     cons.insets = new Insets(3,3,3,3);
  77.     //cons.fill = GridBagConstraints.NONE;
  78.     contentPane.add(label, cons);
  79.     cons.gridy = 3;
  80.     contentPane.add(panel, cons);
  81.  
  82.     frame.pack();
  83.     frame.setSize(600, 600);
  84.     frame.setVisible(true);
  85.   }
  86.  
  87.   public void actionPerformed(ActionEvent e) {
  88.      String langName = "English";    
  89.      Language language = Language.getLanguageForName(langName);
  90.      ConfigurationDialog configDialog = null;
  91.     if (configDialogs.containsKey(language)) {
  92.       configDialog = (ConfigurationDialog)configDialogs.get(language);
  93.     } else {
  94.       configDialog = new ConfigurationDialog(null, false);
  95.       configDialogs.put(language, configDialog);
  96.      // JOptionPane.showMessageDialog(null,"test"); 
  97.     }
  98.     JLanguageTool langTool;
  99.     try {
  100.       langTool = new JLanguageTool(language, configDialog.getMotherTongue());
  101.       langTool.activateDefaultPatternRules();
  102.       langTool.activateDefaultFalseFriendRules();
  103.       Set disabledRules = configDialog.getDisabledRuleIds();
  104.       if (disabledRules != null) {
  105.         for (Iterator iter = disabledRules.iterator(); iter.hasNext();) {
  106.           String ruleId = (String) iter.next();
  107.           langTool.disableRule(ruleId);
  108.         }
  109.       }
  110.     } catch (IOException ioe) {
  111.       throw new RuntimeException(ioe);
  112.     } catch (ParserConfigurationException ex) {
  113.       throw new RuntimeException(ex);
  114.     } catch (SAXException ex) {
  115.       throw new RuntimeException(ex);
  116.     }
  117.     if (e.getActionCommand().equals(OPTIONS_BUTTON)) {
  118.       List rules = langTool.getAllRules();
  119.       configDialog.show(rules);
  120.     } else {
  121.       if (textArea.getText().trim().equals("")) {
  122.         textArea.setText("Please insert text to check here");
  123.       } else {
  124.         StringBuffer sb = new StringBuffer();
  125.         resultArea.setText("Starting check...<br>\n");
  126.         resultArea.repaint(); // FIXME: why doesn't this work?
  127.         //TODO: resultArea.setCursor(new Cursor(Cursor.WAIT_CURSOR)); 
  128.         sb.append("Starting check in " +langName+ "...<br>\n");
  129.         int matches = 0;
  130.         try {
  131.           matches = checkText(langTool, textArea.getText(), sb);
  132.         } catch (Exception ex) {
  133.           sb.append("<br><br><b><font color=\"red\">" + ex.toString() + "<br>");
  134.           StackTraceElement[] elements = ex.getStackTrace();
  135.           for (StackTraceElement element : elements) {
  136.             sb.append(element + "<br>");
  137.           }
  138.           sb.append("</font></b><br>");
  139.           ex.printStackTrace();
  140.         }
  141.         sb.append("Check done. " +matches+ " potential problems found<br>\n");
  142.         resultArea.setText(sb.toString());
  143.         resultArea.setCaretPosition(0);
  144.       }
  145.     }
  146.   }
  147.  
  148.   public int checkText(JLanguageTool langTool, String text, StringBuffer sb) throws IOException {
  149.     long startTime = System.currentTimeMillis();
  150.     List ruleMatches = langTool.check(text);
  151.     long startTimeMatching = System.currentTimeMillis();
  152.     int i = 0;
  153.     for (Iterator iter = ruleMatches.iterator(); iter.hasNext();) {
  154.       RuleMatch match = (RuleMatch) iter.next();
  155.       sb.append("<br>\n<b>" +(i+1)+ ". Line " + (match.getLine() + 1) + ", column " + match.getColumn()
  156.           + "</b><br>\n");
  157.       String msg = match.getMessage();
  158.       msg = msg.replaceAll("<suggestion>", "<b>");
  159.       msg = msg.replaceAll("</suggestion>", "</b>");
  160.       msg = msg.replaceAll("<old>", "<b>");
  161.       msg = msg.replaceAll("</old>", "</b>");
  162.       sb.append("<b>Message:</b> " + msg + "<br>\n");
  163.       sb.append("<b>Context:</b> " + Tools.getContext(match.getFromPos(), match.getToPos(), text));
  164.       sb.append("<br>\n");
  165.       i++;
  166.     }
  167.     long endTime = System.currentTimeMillis();
  168.     sb.append("<br>\nTime: " + (endTime - startTime) + "ms (including "
  169.         + (endTime - startTimeMatching) + "ms for rule matching)<br>\n");
  170.     return ruleMatches.size();
  171.   }
  172.  
  173.   public void openGui (String input) {
  174.       /*final Main prg = new Main();
  175.     prg.createAndShowGUI("They is around. ");*/
  176.     JOptionPane.showMessageDialog(null,"open"); 
  177.     createAndShowGUI(input);
  178.   }
  179.  
  180.  
  181. }
  182.  
I hope you can help me to understand this code too.I really appreciate it.Thanks guys....
Aug 15 '07 #18
teenIce
37
And this is the trace when i try to launch the GUI with my applet.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Java Plug-in 1.6.0_02
  3. Using JRE version 1.6.0_02 Java HotSpot(TM) Client VM
  4. User home directory = C:\Documents and Settings\Administrator
  5. network: Loading user-defined proxy configuration ...
  6. network: Done.
  7. network: Loading proxy configuration from Internet Explorer ...
  8. network: Done.
  9. network: Loading direct proxy configuration ...
  10. network: Done.
  11. network: Proxy Configuration: No proxy
  12.  
  13.  
  14. ----------------------------------------------------
  15. c:   clear console window
  16. f:   finalize objects on finalization queue
  17. g:   garbage collect
  18. h:   display this help message
  19. l:   dump classloader list
  20. m:   print memory usage
  21. o:   trigger logging
  22. p:   reload proxy configuration
  23. q:   hide console
  24. r:   reload policy configuration
  25. s:   dump system and deployment properties
  26. t:   dump thread list
  27. v:   dump thread stack
  28. x:   clear classloader cache
  29. 0-5: set trace level to <n>
  30. ----------------------------------------------------
  31.  
  32. liveconnect: Invoking JS method: document
  33. liveconnect: Invoking JS method: URL
  34. basic: Referencing classloader: sun.plugin.ClassLoaderInfo@12498b5, refcount=1
  35. basic: Added progress listener: sun.plugin.util.GrayBoxPainter@f5da06
  36. basic: Loading applet ...
  37. basic: Initializing applet ...
  38. basic: Starting applet ...
  39. basic: completed perf rollup
  40. liveconnect: Invoking method: public void test.check(java.lang.String)
  41. liveconnect: Needs conversion: java.lang.String --> java.lang.String
  42. java.lang.NullPointerException
  43.     at java.util.Hashtable.put(Unknown Source)
  44.     at javax.swing.JEditorPane.registerEditorKitForContentType(Unknown Source)
  45.     at javax.swing.JEditorPane.registerEditorKitForContentType(Unknown Source)
  46.     at javax.swing.JEditorPane.loadDefaultKitsIfNecessary(Unknown Source)
  47.     at javax.swing.JEditorPane.getKitTypeRegistry(Unknown Source)
  48.     at javax.swing.JEditorPane.getEditorKitClassNameForContentType(Unknown Source)
  49.     at javax.swing.JTextPane.<init>(Unknown Source)
  50.     at mypack.Main.createAndShowGUI(main.java:84)
  51.     at mypack.Main.openGui(main.java:238)
  52.     at test.check(test.java:27)
  53.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  54.     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  55.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  56.     at java.lang.reflect.Method.invoke(Unknown Source)
  57.     at sun.plugin.javascript.JSInvoke.invoke(Unknown Source)
  58.     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  59.     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  60.     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  61.     at java.lang.reflect.Method.invoke(Unknown Source)
  62.     at sun.plugin.javascript.JSClassLoader.invoke(Unknown Source)
  63.     at sun.plugin.com.MethodDispatcher.invoke(Unknown Source)
  64.     at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
  65.     at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
  66.     at java.security.AccessController.doPrivileged(Native Method)
  67.     at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
  68. java.lang.Exception: java.lang.NullPointerException
  69.     at sun.plugin.com.DispatchImpl.invokeImpl(Unknown Source)
  70.     at sun.plugin.com.DispatchImpl$1.run(Unknown Source)
  71.     at java.security.AccessController.doPrivileged(Native Method)
  72.     at sun.plugin.com.DispatchImpl.invoke(Unknown Source)
  73.  
  74.  
Aug 15 '07 #19
any luck in resolving your problem? I have the same exception trace inside of my applet too...

thanks,
Gregory
Aug 30 '07 #20
teenIce
37
any luck in resolving your problem? I have the same exception trace inside of my applet too...

thanks,
Gregory
No, I just don't use the interface anymore. Sorry I'm not so helpful too.
Aug 30 '07 #21
Nepomuk
3,112 Expert 2GB
any luck in resolving your problem? I have the same exception trace inside of my applet too...

thanks,
Gregory
Hi Gregory! Welcome to TSDN!

We might be able to help you nevertheless if you post the relevant code and (even if it's the same) your stack trace.

Greetings,
nepomuk
Aug 30 '07 #22

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: gabryh | last post by:
Hi, The following code throws me NullPointerException. ..... public static boolean isEmpty(String value) { return ((value == null) || (value.trim().equals(""))); }
2
by: Smith | last post by:
The program compiled successfully, but it gives the following error on runtime.... java.lang.NullPointerException at FrogManiaApp.paint(FrogManiaApp.java:102) at...
0
by: Ike | last post by:
I have a signed JApplet which has a JTextArea wherein one can put Jython Script. Upon clicking a JButton, the script is executed. The script which executes to code is listed below. If I run the...
17
oll3i
by: oll3i | last post by:
nevermind the previous prob i posted i m getting further and i get a new exception in readFile method pleae help me with that one thank u a lot in advance java.lang.NullPointerException...
0
by: gezkk | last post by:
hi, i m using http proxy service to get proxy and host to applet, its working fine with jdk1.5 but getting java.lang.NullPointerException in jdk1.6 And the following is mseeage contains java...
1
by: speedygonzalez | last post by:
Hi all! I've a pretty naive problem with my applet which is as follows..... // Wordlist for GRE High Frequency Words import java.awt.*; import java.applet.*;
18
by: pradeep84 | last post by:
hi all, i'm using the following code and i'm getting exception in thread "main" java.lang.nullpointerexception at the line which is in bold. help me to solve this problem import...
1
by: ketand1 | last post by:
import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import java.sql.*; import java.lang.*; class DbAwt extends Frame implements ActionListener { private...
2
by: sokeefe | last post by:
I am trying to edit the GUI of a project in Netbeans. In particular, I am trying to add new JButtons. I get a NullPointerException when I try to add an Event to any given JButton (even ones that...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.