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

Merlin: repaints do not work by using javaw on WinNT if double buffering is disa

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.0
    • client-libs
    • 2d
    • x86
    • windows_2000


      ingrid.yao@Eng 2001-05-14

      This problem only happens on Win2000 machine, not on WinNT machine and
      it only happens when you use javaw not java. If you enable double-buffering,
      everything works fine.


      J2SE Version (please include all output from java -version flag):

      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b62)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b62, mixed mode)

      Does this problem occur on J2SE 1.3? Yes / No (pick one)
      no


      Operating System Configuration Information (be specific):
      Windows 2000 SP1;
      Other platforms untested

      Hardware Configuration Information (be specific):
      PIII-800, 256 MB, Nvidia Geforce


      Bug Description:

      Timed repaints (probably all programmatically invoked repaints) do not work
      in JDK 1.4 Merlin Swing if double buffering is disabled. If double-buffering
      is disabled and repaint() is called repaints are executed only if events are
      generated (for example the mouse is moved over the window).

      This causes caret blinking in CodeGuide (our Java IDE) to cease working in
      Merlin right now.


      Test Program
      =============

      /**
       * This test program displays a frame which contains a solid rectangle whose
       * color alternates from black to white and back every 200ms.
       *
       * Works as advertized on JDK 1.3
       *
       * Only alternates from black to white if events are generated (i.e. the mouse
       * is moved across the window) on Merlin (b60).
       */

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class TimerTest
      {
      /**
      * This method is called after start up.
      */
      public static void main(String[] args)
      {
      // Create application frame.
      JFrame frame = new JFrame();
      RepaintManager.currentManager(frame).setDoubleBufferingEnabled(false);
      frame.getContentPane().add(new TestComponent());
      frame.pack();
      frame.show();
      }

      private static class TestComponent extends JComponent
      {
      private boolean displayBlack;

      public TestComponent()
      {
      Timer t = new Timer
      (
      200,
      new ActionListener()
      {
      public void actionPerformed(ActionEvent e)
      {
      displayBlack = ! displayBlack;
      repaint(getBounds());
      }
      }
      );

      t.setRepeats(true);
      t.start();

      setPreferredSize(new Dimension(300,300));
      }

      public void paintComponent(Graphics g)
      {
      Color c;
      if (displayBlack)
      c = Color.black;
      else
      c = Color.white;
      g.setColor(c);
      Rectangle r = g.getClipBounds();
      g.fillRect(r.x,r.y,r.width,r.height);
      }
      }
      }

            tdv Dmitri Trembovetski (Inactive)
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: