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

java.awt.event.MouseEvent constructor should mention throwing HE in headless mode

XMLWordPrintable

    • b60
    • generic
    • generic
    • Verified

      For JDK7 the following code

      public class Test {
          public static void main(String[] args) {
              new java.awt.event.MouseEvent(new javax.swing.JButton(), 0, 0, 0, 0,0,0,true, 0);
          }
      }

      if executed with -Djava.awt.headless=true

      will throw something like:

      Exception in thread "main" java.lang.ExceptionInInitializerError
              at Test.main(Test.java:4)
      Caused by: java.awt.HeadlessException
              at java.awt.MouseInfo.getNumberOfButtons(MouseInfo.java:122)
              at java.awt.event.MouseEvent.<clinit>(MouseEvent.java:420)
              ... 1 more

            dav Andrei Dmitriev (Inactive)
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: