Set Drawing Mode To XOR - Java 2D Graphics

Java examples for 2D Graphics:Paint

Description

Set Drawing Mode To XOR

Demo Code

 
import java.applet.Applet;
import java.awt.Color;
import java.awt.Graphics;
 
public class Main {
 
        public void paint(Graphics g){
                //setForeground(Color.RED);
                g.setXORMode(Color.GRAY);
                g.fillRect(10,10,50,50);
                g.fillRect(20,30,50,50);
               /*from ww w. j  a va  2 s  . co  m*/
                g.setPaintMode();
        }
}

Related Tutorials