Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / February 2006

Tip: Looking for answers? Try searching our database.

Method for White Circle with black background

Thread view: 
sheldon.sc@gmail.com - 16 Feb 2006 09:49 GMT
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
Roedy Green - 16 Feb 2006 14:54 GMT
>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.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Oliver Wong - 16 Feb 2006 18:50 GMT
>I need help with making a method to get a white circle with a black
> background.
[quoted text clipped - 29 lines]
>        }//end if
> }//end class

   Could it be that the code that draws a white circle is completely
commented out?

   - Oliver
sheldon.sc@gmail.com - 16 Feb 2006 20:05 GMT
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
Oliver Wong - 16 Feb 2006 20:40 GMT
> 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
sheldon.sc@gmail.com - 17 Feb 2006 05:44 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.