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

JLayer should have a default UI delegate

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • 7
    • 7
    • client-libs
    • None

      When an instance of JLayer is created with help of JLayer(Component) constructor,
      it doesn't have a ui delegate by default and so cannot be painted on screen.

      import javax.swing.*;

      public class LayerTest {

          private static void createGui() {
              final JFrame frame = new JFrame();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

              // JButton is not painted
              frame.add(new JLayer(new JButton("Hello")));

              frame.setSize(200, 200);
              frame.setLocationRelativeTo(null);
              frame.setVisible(true);
          }

          public static void main(String[] args) throws Exception {
              SwingUtilities.invokeAndWait(new Runnable() {
                  public void run() {
                      LayerTest.createGui();
                  }
              });
          }
      }

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: