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

Popup(Component, Component, int, int) throws HeadlessException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.0
    • 1.4.0
    • client-libs
    • beta2
    • sparc
    • solaris_7



      Name: sdR10048 Date: 06/11/2001


      protected Popup(Component owner, Component contents, int x, int y)
      throws undocumented HeadlessException in headless implementation.
      See example for details:
      --------------------------------------------------
      [archer] ~/tmp
      % cat Test.java
      import java.awt.*;
      import javax.swing.*;

      class StubPopup extends Popup {
          public StubPopup(Component owner, Component contents, int x, int y) {
              super(owner, contents, x, y);
          }
      }

      public class Test {
          public static void main(String[] args) {
              new StubPopup(new Canvas(), new Canvas(), 0, 0);
          }
      }
      [archer] ~/tmp
      % java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
      [archer] ~/tmp
      % javac Test.java
      [archer] ~/tmp
      % java -Djava.awt.headless=true Test
      Exception in thread "main" java.awt.HeadlessException
              at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:123)
              at java.awt.Window.<init>(Window.java:252)
              at java.awt.Frame.<init>(Frame.java:390)
              at java.awt.Frame.<init>(Frame.java:355)
              at javax.swing.Popup$DefaultFrame.<init>(Popup.java:208)
              at javax.swing.Popup.getParentWindow(Popup.java:160)
              at javax.swing.Popup.createComponent(Popup.java:171)
              at javax.swing.Popup.reset(Popup.java:115)
              at javax.swing.Popup.<init>(Popup.java:72)
              at StubPopup.<init>(Test.java:6)
              at Test.main(Test.java:12)
      --------------------------------------------------
      Javadoc says:

      protected Popup(Component owner,
                      Component contents,
                      int x,
                      int y)

           Creates a Popup for the Component owner containing the Component contents. owner is used to
           determine which Window the new Popup will parent the Component the Popup creates to. A null
           owner implies there is no valid parent. x and y specify the preferred initial location to
           place the Popup at. Based on screen size, or other paramaters, the Popup may not display at
           x and y.

           Parameters:
               owner - Component mouse coordinates are relative to, may be null
               contents - Contents of the Popup
               x - Initial x screen coordinate
               y - Initial y screen coordinate
           Throws:
               IllegalArgumentException - if contents is null

      ======================================================================

            svioletsunw Scott Violet (Inactive)
            dsvsunw Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: