hi guys i need sum help creating a little programme.
when the mouse is in the box the colour has to change to black and when the mouse is outside the box the colour has to change to red. This has to be on loop.
I startd it of something like dis:
public class age
public static void main(String args)
DrawingWindow d = new DrawingWindow();
Rect r = new Rect(25,05,18,1;
this code only creates the box need helping with the rest changing colour when the mouse is in and out the box.
To detect mouse movements etc you will need to use a MouseListener of some kind.
There have been several sample programs with listeners on the forum, so do a search for the different mouse listeners and you should get lots of examples of code to look at.
You'll find that the MouseListener class has MOUSE_ENTERED and MOUSE_EXITED events which allow you to capture when the mouse has entered or left your component. Just capture the event and then fire the appropriate color change.
Last Post: 06-14-2006, 04:16 PM
Last Post: 05-13-2005, 07:46 AM
By Mike Tsakiris in forum .NET
Last Post: 10-04-2002, 06:32 PM
By Anonymous in forum Java
Last Post: 02-01-2002, 12:08 AM
By JJ in forum Enterprise
Last Post: 07-06-2000, 05:50 AM
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL