-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.2.0
-
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)
======================================================================
- duplicates
-
JDK-4188879 JMark2.0 Images-XOR Mode test appears not to work
-
- Resolved
-