Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Whatz the problem  RSS feed

 
vinaya kumar
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
i am getting this error sometimes when
i am using popup menu ..
i am not sure why this is coming
any clue ???

Exception occurred during event dispatching:
java.lang.NullPointerException: null pData
at
sun.awt.windows.WInputMethod.handleNativeIMEEvent(Native Method)
at sun.awt.windows.WInputMethod.dispatchEvent(Unknown
Source)
at sun.awt.im.InputContext.dispatchEvent(Unknown Source)
at sun.awt.im.InputMethodContext.dispatchEvent(Unknown
Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at
java.awt.LightweightDispatcher.trackMouseEnterExit(Unknown
Source)
at
java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown
Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEvent(Unknown
Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown
Source)
at java.awt.EventDispatchThread.run(Unknown Source)
i browsed the net to find people with similar
prblms but no solution..[see below urls]

Thanks and Regards
vinaya

web page java forum
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We need to see the code that is causing this problem.
 
vinaya kumar
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here it is..
but i don't get the error always..
Press A in the TextField to obtain the popmenu
sometimes i get th exception
import java.awt.*;
import javax.swing.*;

/**
*
* @author Administrator
* @version
*/
public class ToyFrame extends javax.swing.JFrame {

/** Creates new form ToyFrame */
public ToyFrame() {
initComponents ();
pack ();
}

/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the FormEditor.
*/
private void initComponents ()
{
jPopupMenu1 = new javax.swing.JPopupMenu ();
jMenuItem1 = new javax.swing.JMenuItem ();
jMenuItem2 = new javax.swing.JMenuItem ();
jMenuBar1 = new javax.swing.JMenuBar ();
jMenu1 = new javax.swing.JMenu ();
jMenuItem3 = new javax.swing.JMenuItem ();
jMenuItem4 = new javax.swing.JMenuItem ();
jMenu2 = new javax.swing.JMenu ();
jMenuItem5 = new javax.swing.JMenuItem ();
jTextField1 = new javax.swing.JTextField ();

jMenuItem1.setMnemonic ('1');
jMenuItem1.setText ("Item 1");

jPopupMenu1.add (jMenuItem1);
jMenuItem2.setMnemonic ('2');
jMenuItem2.setText ("Item 2");

jPopupMenu1.add (jMenuItem2);

jMenu1.setMnemonic ('F');
jMenu1.setText ("File");

jMenuItem3.setMnemonic ('O');
jMenuItem3.setText ("Open");

jMenu1.add (jMenuItem3);
jMenuItem4.setMnemonic ('C');
jMenuItem4.setText ("Close");

jMenu1.add (jMenuItem4);
jMenuBar1.add (jMenu1);
jMenu2.setMnemonic ('E');
jMenu2.setText ("Edit");

jMenuItem5.setMnemonic ('C');
jMenuItem5.setText ("Cut");

jMenu2.add (jMenuItem5);
jMenuBar1.add (jMenu2);
addWindowListener (new java.awt.event.WindowAdapter ()
{
public void windowClosing (java.awt.event.WindowEvent evt)
{
exitForm (evt);
}
}
);

jTextField1.setText ("jTextField1");
jTextField1.addKeyListener (new java.awt.event.KeyAdapter ()
{
public void keyReleased (java.awt.event.KeyEvent evt)
{
jTextField1KeyReleased (evt);
}
}
);


getContentPane ().add (jTextField1, java.awt.BorderLayout.CENTER);

setJMenuBar (jMenuBar1);

}

private void jTextField1KeyReleased (java.awt.event.KeyEvent evt) {
if ( evt.getKeyCode() == java.awt.event.KeyEvent.VK_A )
{
Component comp = (Component)evt.getSource();
jPopupMenu1.show(comp, comp.getX() + comp.getHeight() / 2,
comp.getY()
+ comp.getHeight() / 2);
jPopupMenu1.setRequestFocusEnabled(true);
jPopupMenu1.requestFocus();

}
}

/** Exit the Application */
private void exitForm(java.awt.event.WindowEvent evt) {
System.exit (0);
}

/**
* @param args the command line arguments
*/
public static void main (String args[]) {
new ToyFrame ().show ();
}


// Variables declaration - do not modify
private javax.swing.JPopupMenu jPopupMenu1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JMenuItem jMenuItem4;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuItem jMenuItem5;
private javax.swing.JTextField jTextField1;
// End of variables declaration

}
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I typed A in that TextField probably 200 times and never got an error message. I am running JDK1.4.1 on Windows XP. What is your enviornment like?
 
vinaya kumar
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i get this error! sometimes!
i am using 1.3.1
this is jdk bug to have been fixed in 1.1.8

i have no clue of whatz the problem and whatz the fix..
i am not able to reproduce this too...
it happenes..
Thanks
Regards
vinaya
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!