Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4408235

JPopupMenu.setVisible(true) throws HeadlessException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 1.4.0
    • Fix Version/s: None
    • Component/s: client-libs

      Description



      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)
      --------------------------------------------------
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mdavidsosunw Mark Davidson (Inactive)
                Reporter:
                dsvsunw Dsv Dsv (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: