• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XOR mode??

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey java ppl
i have a problem.
Plz read the code
public void paint(Graphics g)
{
setBackground(Color.white);
g.setColor(Color.blue); //(Line 1)
g.fillRect(50,10,50,50);
g.setColor(Color.red); //(line 2)
g.fillRect(110,60,50,50);
g.setXORMode(Color.black);
g.fillRect(75,35,50,50);
}
I understand that result of overlapping color. done here(line 2) by drawing some thing(rect in this case) in XOR mode can be predicted(i.e will be color given to setXORMode(Color c) method.
Can it be possible to predict what will happen when some thing drawn in XOR mode overlaps some thing drawn in previous paint mode like at (Line 1).if yes how??
Regards Denish
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hope this helps, taken from Java Class Libraries
In Xor paint mode, when you paint the object for the first time, it won't appear in the correct color. The color that appears is based on both the foreground and background colors; the exact color chosen is platform-dependent. In Xor paint mode, one special color called the xor color will not affect the foreground color. That is, if you paint on an xor color colored background, the foreground color will come out as expected. One final effect of xor paint mode: If the foreground color is the same as the xor color, the painting operation is ignored.
 
reply
    Bookmark Topic Watch Topic
  • New Topic