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

JDK 1.2 setXORMode problems with resolution (256)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • client-libs
    • 2d
    • x86
    • windows_nt



      Name: dbT83986 Date: 03/25/99


      The 1.2 JDK version of setXORMode (Sun's XORComposite class) only
       works with colors which have RGB values of 0xff or 0. Any other
       RGB values cause random colors to be left on the screen.

      Java Version: java full version "JDK-1.2-V"

      BTW: setXORMode works fine with JDK V1.1.7a


      The following java code demonstrates the problem:

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


      public class paint extends JFrame
      {
        public paint()
        {
          try
          {
              MyJPanel paintCanvas = new MyJPanel();

              paintCanvas.setPreferredSize(new Dimension(400, 400));
              getContentPane().add(paintCanvas, BorderLayout.CENTER);

              pack();

              setVisible(true);

              paintCanvas.repaint();

          }
          catch (Exception e)
          {
            e.printStackTrace();
          }
        }

        public static void main(String[] args)
        {

          try
          {
              UIManager.setLookAndFeel(new
                  com.sun.java.swing.plaf.windows.WindowsLookAndFeel());


          }
          catch (Exception e)
          {
            e.printStackTrace();
          }

          paint bobPaint = new paint();

          bobPaint.addWindowListener
          (
              new WindowAdapter()
              {
                  public void windowClosing(WindowEvent e)
                  {
                      System.exit(0);
                  }
              }
          );

        }
          

        class MyJPanel extends JPanel
        {
          public void paintComponent(Graphics g)
          {

              //-- Make the panel white
              g.setColor(Color.white);
              g.fillRect(0, 0, 400, 400);

              //-- Draw an olive rectangle using XOR Mode
              g.setColor(new Color(128, 128, 64));
              g.setXORMode(Color.white);
              g.fillRect(100, 100, 100, 100);


              //-- Do the same thing again to XOR out rectangle
              g.setColor(new Color(128, 128, 64));
              g.setXORMode(Color.white);
              g.fillRect(100, 100, 100, 100);

              //-- Panel should be completely white, but its not!
              //-- It has a kelly-green rectangle in it.

          }
          
        }

      }

      =============================
      REVIEW NOTE 3/25/99 - User responded with additional information

      My resolution is 1024x768 (256 colors).
      I have a cirrus compatible display adapter (its using a Microsoft driver -- version 4.00)

      It does work if I change to lower resolution and 64K colors. However, any color
      configuration less than 64K makes the problem reappear.

      Is there a way to make it work with the current config? When I used JDK V1.1.7a, it
      didn't have this problem.
      (Review ID: 55899)
      ======================================================================

            Unassigned Unassigned
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: