Switch to full style
General Java code examples
Post a reply

XOR Mode in java

Tue Nov 11, 2008 6:09 pm

XOR of colors Mode in java
Code:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class 
UseXORMode extends JPanel {
  
UseXORMode() {
    
setBackground(Color.black);
  }
public 
void paintComponent(Graphics g) {
    
super.paintComponent(g);
    
g.setColor(Color.red);
    
g.fillOval(30209040);
    
g.setColor(Color.yellow);
    
g.fillOval(60309040);
    
g.setColor(Color.blue);
    
g.fillOval(140507040);
    
g.setXORMode(Color.yellow);
    
g.fillOval(100409040);
  }
  public static 
void main(String[] args) {
    
JFrame frame = new JFrame("Use XOR Mode");
    
frame.setSize(350200);
    
Container contentPane frame.getContentPane();
    
contentPane.add(new UseXORMode());
    
frame.show();
  }
  } 



Attachments
XORMode.gif
the output
XORMode.gif (5.4 KiB) Viewed 8300 times

Post a reply
  Related Posts  to : XOR Mode in java
 Fill DataGrid In Connected Mode     -  
 2d game in java-Monster-Java 2D Game Graphics and Animation     -  
 What is Java API?!!!     -  
 java or .net     -  
 need help in java     -  
 Using FTP in java     -  
 what is java     -  
 Java course     -  
 Java Servlet and JSP     -  
 Suggestion for job in java     -  

Topic Tags

Java Graphics