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

REGRESSION Graphics.drawString does not work after Graphics.setXORMode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.1
    • 1.4.0
    • client-libs
    • 2d
    • hopper
    • x86
    • windows_nt



      Name: ddT132432 Date: 09/21/2001


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

      After I use a 'Graphics.setXORMode()' operation I cannot get the
      'Graphics.drawString()' methods to draw correctly.

      This bug seems to be only reproducable on Windows machines only.

      This code works correctly in JDK1.3, but not in JDK1.4B2.

      Under JDK1.3.1 ---- The string "Goodbye" is displayed
      When running this program you will notice that the string "Hello"
      is printed and a blue box is drawn, and the String "Goodbye" is drawn
      to the screen as well.

      Under JDK1.4beta2-b77 ---- The string "Goodbye" is NOT displayed
      When running this program you will notice that the string "Hello"
      is printed and a blue box is drawn, and the String "Goodbye" is NOT drawn
      to the screen.

      This seems to be a Regression bug


      Source Code
      ----------------------
      import java.awt.*;
      import javax.swing.*;

      public class TestBug extends JPanel {


          public void paintComponent(Graphics g) {
      super.paintComponent(g);

      Font defaultFont = new Font("Dialog", Font.PLAIN, 9);
      g.setFont(defaultFont);

      g.setColor(Color.black);
      g.drawString("Hello", 10, 10);

      g.setColor(Color.white);
      g.setXORMode (Color.blue);
      g.drawRect(30, 10, 10, 10);
      g.setPaintMode();
      g.setColor(Color.black);

              // The following will not display in JDK1.4B2, but will in JDK1.3
      g.drawString("Goodbye", 10, 50);

          }

         public static void main(String[] args) {

            JFrame f = new JFrame("Test");
            f.getContentPane().add(new TestBug());
            f.setSize(100,100);
            f.setVisible(true);
         }
      }
      ---------------
      (Review ID: 132321)
      ======================================================================

      Verified fix with jdk build 1.4.1-beta-b09, mixed mode on w2k.

      ###@###.### 2002-04-24

            flar Jim Graham
            ddressersunw Daniel Dresser (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: