 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Thu Feb 16, 2006 10:12 am Post subject: Method for White Circle with black background |
|
|
I need help with making a method to get a white circle with a black
background.
On clicking a button the circle turns to black On clicking the button
again it turns back to the white circle with a black background again.
import aLibrary.*;
import java.awt.event.*;
import java.awt.Color;
public class DotBW extends Dot{
private AOval theDot;
public DotBW(int a, int b){
super(a, b, 50, 50);
//theDot = new AOval();
setColor(Color.black);
}
public void action(){
Color fillColor = this.getColor();
if (fillColor == Color.black) {
this.setToFill();
//this.setColor(Color.white);
//this.setToFill(Color.white);
} else {
//this.repaint();
this.setColor(Color.black);
this.setToFill();
}
this.repaint();
}//end if
}//end class |
|
| Back to top |
|
 |
Roedy Green Guest
|
Posted: Thu Feb 16, 2006 3:12 pm Post subject: Re: Method for White Circle with black background |
|
|
On 16 Feb 2006 01:49:27 -0800, sheldon.sc (AT) gmail (DOT) com wrote, quoted or
indirectly quoted someone who said :
| Quote: |
import aLibrary.*;
import java.awt.event.*;
import java.awt.Color;
public class DotBW extends Dot{
|
if some one is to understand your code, they need to understand Dot
too.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching. |
|
| Back to top |
|
 |
Oliver Wong Guest
|
Posted: Thu Feb 16, 2006 7:12 pm Post subject: Re: Method for White Circle with black background |
|
|
<sheldon.sc (AT) gmail (DOT) com> wrote in message
news:1140083367.168684.275960 (AT) z14g2000cwz (DOT) googlegroups.com...
| Quote: | I need help with making a method to get a white circle with a black
background.
On clicking a button the circle turns to black On clicking the button
again it turns back to the white circle with a black background again.
import aLibrary.*;
import java.awt.event.*;
import java.awt.Color;
public class DotBW extends Dot{
private AOval theDot;
public DotBW(int a, int b){
super(a, b, 50, 50);
//theDot = new AOval();
setColor(Color.black);
}
public void action(){
Color fillColor = this.getColor();
if (fillColor == Color.black) {
this.setToFill();
//this.setColor(Color.white);
//this.setToFill(Color.white);
} else {
//this.repaint();
this.setColor(Color.black);
this.setToFill();
}
this.repaint();
}//end if
}//end class
|
Could it be that the code that draws a white circle is completely
commented out?
- Oliver |
|
| Back to top |
|
 |
Guest
|
Posted: Thu Feb 16, 2006 8:12 pm Post subject: Re: Method for White Circle with black background |
|
|
Well I just need to know the method to make the black and white dot.
It is with a black background by default when the program runs and on
clicking a button it fills up then clicking on the button again
un-fills it. I could not think of any other way to keep a black
background when it's supposed to be white. If I just toggle between
colors then I tend to loose the border when it changes to white so it
is there but you cannot see it.
import aLibrary.*;
import java.awt.*;
public abstract class Dot extends AOval{
public Dot(int a, int b, int c, int d){
super(a,b,c,d);
}
public abstract void action();
}//end class |
|
| Back to top |
|
 |
Oliver Wong Guest
|
Posted: Thu Feb 16, 2006 9:12 pm Post subject: Re: Method for White Circle with black background |
|
|
<sheldon.sc (AT) gmail (DOT) com> wrote in message
news:1140120344.022686.91760 (AT) z14g2000cwz (DOT) googlegroups.com...
| Quote: | Well I just need to know the method to make the black and white dot.
|
Nobody can know without looking at the code in "aLibrary". So ask your
teacher; this isn't an unreasonable question to ask.
- Oliver |
|
| Back to top |
|
 |
Guest
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|