Duplicate :
|
Name: sdR10048 Date: 01/25/2001 public void javax.swing.JPopupMenu.setVisible(true) throws unspecified HeadlessException in headless mode. Javadoc says: -------------------------------------------------- public void setVisible(boolean b) Sets the visibility of the popup menu. Overrides: setVisible in class JComponent Parameters: b - true to make the popup visible, or false to hide it See example: -------------------------------------------------- [sword] ~/tmp % cat Test.java import javax.swing.*; public class Test { public static void main(String[] args) { JPopupMenu c = new JPopupMenu(); c.setVisible(true); } } [sword] ~/tmp % javac Test.java [sword] ~/tmp % java -Djava.awt.headless=true Test Exception in thread "main" java.lang.NullPointerException at javax.swing.JPopupMenu.getPopup(JPopupMenu.java:733) at javax.swing.JPopupMenu.setVisible(JPopupMenu.java:683) at Test.main(Test.java:5) [sword] ~/tmp % java -version java version "1.4.0-beta" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b48) Java HotSpot(TM) Client VM (build 1.4beta-B48, mixed mode) -------------------------------------------------- ======================================================================