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

JLayeredPane: setLayer/getLayer is not working properly with awt Component

XMLWordPrintable

    • swing1.0.3
    • x86
    • windows_95
    • Verified

      To reproduce(JDK1.1.5 Swing-Pre-1.0(2/3) WindowNT):

      1) run the following code.
      2) output will be

      3 // bad
      3 // bad
      3
      1
      2
      3


      import java.awt.*;
      import java.awt.event.*;
      import com.sun.java.swing.*;

       public class LayerTest
       {
          public static void main(String[] args) {
              Button b1 = new Button();
              Button b2 = new Button();
              Button b3 = new Button();
              JButton jb1 = new JButton();
              JButton jb2 = new JButton();
              JButton jb3 = new JButton();

              JLayeredPane lp = new JLayeredPane();
              lp.setLayer(b1, 1);
              lp.setLayer(b2, 2);
              lp.setLayer(b3, 3);
              lp.setLayer(jb1, 1);
              lp.setLayer(jb2, 2);
              lp.setLayer(jb3, 3);
              System.out.println(lp.getLayer(b1));
              System.out.println(lp.getLayer(b2));
              System.out.println(lp.getLayer(b3));
              System.out.println(lp.getLayer(jb1));
              System.out.println(lp.getLayer(jb2));
              System.out.println(lp.getLayer(jb3));
          }

      }

            rschiavisunw Richard Schiavi (Inactive)
            bkimsunw Bae-chul Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: