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

Graphics.drawLine() freezes in paint() in DoubleBuffer mode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.3.0
    • client-libs
    • 2d
    • x86
    • windows_nt



      Name: krC82822 Date: 05/02/2000


      2 May 2000, eval1127@eng -- reproducible with 1.3.0-C on NT 4.0 SP 6a. Task Manager must be used to kill the process.
      (Works fine with double-buffering turned off.)

      java version "1.3.0rc3"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc3-Z)
      Java HotSpot(TM) Client VM (build 1.3.0rc3-Z, mixed mode)

      If we set a large x or y value for a point's coordinate, Graphics.drawLine()
      freezes in the paint() method for Swing components in
      DoubleBuffer mode (under Windows NT).

      Try the following program :

      If you run this DrawLineFreeze class, NT freezes after the JFrame becomes visible.
      This happens when JPanel's paint() is invoked with DoubleBuffer mode
      //----------------------------------------------------------
      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;
      import java.util.*;

      class DrawLineFreeze extends JFrame {
         JButton test1, test2;
          
         public static void main( String[] arg ){
            JFrame w = new DrawLineFreeze();
            w.setDefaultCloseOperation(3);
            w.setSize( 500, 500 );
            w.setVisible( true );
         }
         DrawLineFreeze(){
            FreezePanel panel = new FreezePanel();
            Container pane = getContentPane();
            pane.add( panel, BorderLayout.CENTER );
            
      RepaintManager.currentManager(getRootPane()).setDoubleBufferingEnabled(true);
            
      //RepaintManager.currentManager(getRootPane()).setDoubleBufferingEnabled(false);
         }

        class FreezePanel extends JPanel {
          public void paint( Graphics g ){
               g.drawLine( -100000, -100000, 100000, 100000 );
               g.drawLine( -100000, 100000, 500, 0 );
          }
        }
      }
      //---------------------------------------------------------------------------
      (Review ID: 103963)
      ======================================================================

            Unassigned Unassigned
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: