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

Bug with setAlwaysOnTop(true) on a JFrame when displaying JOptionPane

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P3 P3
    • 6-pool
    • 6u24
    • client-libs

      FULL PRODUCT VERSION :
      java version 1.6.0_24

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [version 5.1.26001]

      A DESCRIPTION OF THE PROBLEM :
      An always on top JFrame can become a classical JFrame when a JOptionPane (maybe all modal frame) is display under the JFrame if you try to move the JFrame

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      First create a JFrame and set it always on top with the method " setAlwaysOnTop "

      Display a JOptionPane, with JOptionPane.showConfirmDialog(null, null); under the JFrame.

      If you try to move the JFrame to see the JOptionPane the JOptionPane will be focused but the JFrame is no mode Alway on top now.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The JFrame should stay always on top
      ACTUAL -
      The JFrame is no more always on top

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;

      import javax.swing.JButton;
      import javax.swing.JFrame;
      import javax.swing.JOptionPane;
      import javax.swing.JPanel;


      public class Main {

      /**
       * @param args
       */
      public static void main(String[] args) {
      JFrame frame = new JFrame( " Bug " );
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setAlwaysOnTop(true);

      JPanel panel = new JPanel();
      frame.setContentPane(panel);

      JButton test = new JButton( " Test " );
      test.addActionListener(new ActionListener() {

      @Override
      public void actionPerformed(ActionEvent arg0) {
      JOptionPane.showConfirmDialog(null, null);
      }
      });

      panel.add(test);
      frame.setSize(200,200);
      frame.setLocationRelativeTo(null);
      frame.setVisible(true);

      }

      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Not found

            mcherkas Mikhail Cherkasov (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: