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, 03:16 PM
Last Post: 05-13-2005, 06:46 AM
By Mike Tsakiris in forum .NET
Last Post: 10-04-2002, 05:32 PM
By Anonymous in forum Java
Last Post: 01-31-2002, 11:08 PM
By JJ in forum Enterprise
Last Post: 07-06-2000, 04: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