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

Sample provided in javax.swing.JLayer class description is not usable

XMLWordPrintable

    • b74
    • generic
    • generic

      Sample that is provided with javax.swing.JLayer class description is unusable.
      http://download.java.net/jdk7/docs/api/javax/swing/JLayer.html

      It contains several problems:

      1) There's no way to take it and drop to main method of a simple "HelloWorld" class. Variable "frame" is undefined, frame size should be set and it should be shown.

      2) A typo in "public void paint(Graphics g, JCompo nent c) {", there's an extra two spaces in arg type definition.

      3) After corrections above JDK7b70 gives a compilation error:
      Test.java:29: name clash: eventDispatched(AWTEvent,JLayer<JPanel>) in null and eventDispatched(AWTEvent,JLayer<? extends
       V>) in LayerUI have the same erasure, yet neither overrides the other
                 public void eventDispatched(AWTEvent e, JLayer<JPanel> l) {
                             ^
        where V is a type-variable:
          V extends Component declared in class LayerUI
      1 error

      4) After fixing method "public void eventDispatched(AWTEvent e, JLayer<? extends JPanel> l)" executed sample won't work because mouse events will not be dispatched. An additional line:
      layer.setLayerEventMask(AWTEvent.MOUSE_MOTION_EVENT_MASK);
      should be added

            alexp Alexander Potochkin (Inactive)
            dbessono Dmitry Bessonov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: