Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Show XOR Mode 
 

XOR or Exclusive Or returns true only if both its operands have different values. The XOR shows the uncommon part. We are providing you an example which shows the XOR mode.

 

Show XOR Mode

                         

In this section, you will studied about the XOR mode. 

XOR or Exclusive Or returns true only if both its operands have different values. The XOR shows the uncommon part. We are providing you an example which shows the XOR mode.

The method setXORMode(Color.yellow) of Graphics class sets the paint mode between the current color and the new specified color. We have defined four circles showing the XOR mode on the forth circle. The logical pixel operations are performed in the XOR mode, which alternates pixels between the current color and a specified XOR color.

Here is the code of UseXORMode.java

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();
  }
  }

Output will be displayed as:

 

Download Source Code

                         

» View all related tutorials
Related Tags: c ide class methods method get icon height vi width change using int id ai create js define show paint

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.