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

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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.4.0
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      beta2
    • CPU:
      sparc
    • OS:
      solaris_7

      Description



      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

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

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: