AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Method for White Circle with black background

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Thu Feb 16, 2006 10:12 am    Post subject: Method for White Circle with black background Reply with 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
Back to top
Roedy Green
Guest





PostPosted: Thu Feb 16, 2006 3:12 pm    Post subject: Re: Method for White Circle with black background Reply with quote



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





PostPosted: Thu Feb 16, 2006 7:12 pm    Post subject: Re: Method for White Circle with black background Reply with quote



<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






PostPosted: Thu Feb 16, 2006 8:12 pm    Post subject: Re: Method for White Circle with black background Reply with quote

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





PostPosted: Thu Feb 16, 2006 9:12 pm    Post subject: Re: Method for White Circle with black background Reply with quote

<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






PostPosted: Fri Feb 17, 2006 6:12 am    Post subject: Re: Method for White Circle with black background Reply with quote

http://rapidshare.de/files/13435018/aLibrary.zip.html

http://rapidshare.de/files/13435131/aLibraryDocs.zip.html

You can find the ALibrary and docs on the above links
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.