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

Flickering when a new JFrame is launched

XMLWordPrintable

      FULL PRODUCT VERSION :


      ADDITIONAL OS VERSION INFORMATION :
      Windows XP

      A DESCRIPTION OF THE PROBLEM :
      When a JDialog is created and set to visible there is a flicker. First JDialog background paints. Then contents paint. For example:

      newDialog = new JDialog();
      newDialog.setModal(true);
      newDialog.setSize(new Dimension(600,400));
      newDialog.setBackground(Color.red);
      JPanel greenPanel = new JPanel();
      greenPanel.setBackground(Color.green);
      newDialog.getContentPane().add(greenPanel);

      After you set the newDialog to visible you see the red first, then green. I would expect that the entire dialog would be painted and then final result is displayed. Instead we see the empty frame first. Thus resulting in a flicker.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      When a JDialog is created and set to visible there is a flicker. First JDialog background paints. Then contents paint. For example:

      newDialog = new JDialog();
      newDialog.setModal(true);
      newDialog.setSize(new Dimension(600,400));
      newDialog.setBackground(Color.red);
      JPanel greenPanel = new JPanel();
      greenPanel.setBackground(Color.green);
      newDialog.getContentPane().add(greenPanel);

      After you set the newDialog to visible you see the red first, then green. I would expect that the entire dialog would be painted and then final result is displayed. Instead we see the empty frame first. Thus resulting in a flicker.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I would expect that the entire dialog would be painted and then final result is displayed.

      ACTUAL -
      After you set the newDialog to visible you see the red first, then green. I would expect that the entire dialog would be painted and then final result is displayed. Instead we see the empty frame first. Thus resulting in a flicker.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import java.awt.*;

      public class Test
      {
      public static void main(String[] args)
      {
      JDialog newDialog = new JDialog();
      newDialog.setModal(true);
      newDialog.setSize(new Dimension(600,400));
      newDialog.setBackground(Color.red);
      JPanel greenPanel = new JPanel();
      greenPanel.setBackground(Color.green);
      newDialog.getContentPane().add(greenPanel);
      newDialog.setVisible(true);
      }
      }

      ---------- END SOURCE ----------
      ###@###.### 2005-05-09 08:24:07 GMT

            svioletsunw Scott Violet (Inactive)
            jssunw Jitender S (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: