I'm attempting to understand how to use popupmenus in my code but I keep getting:
"Exception in
thread "AWT-EventQueue-0" java.lang.NullPointerException: parent is
null
at java.awt.PopupMenu.show(PopupMenu.java:149)
at PopupMenuTest$PopupListener.maybeShowPopup(PopupMenuTest.java:50)
at PopupMenuTest$PopupListener.mouseReleased(PopupMenuTest.java:45)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:2
90) etc..."
I'm using this to
test:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
Most of it I used actual snippets from
java example codes, but it doesn't work!!
Can anyone tell me how to properly use popupmenus? I know I'm missing some crucial detail somewhere.