![]() |
need to know how to give movements/actions..
HeLLo..i have a java project about graphics..the project is about designing a kitchen..i easiLy made the designing the kitchen's objects..i am aLso asked to give some movements to the objects..but i am stuck with giving the actions and movements..for exampLe when i click to the oven with the mouse the coLor can change..or some other movements..:)i think you understand my probLem..can someone pLease heLp me with this:(thanx a Looott..
gonc.. |
Sounds like what you need to learn about is event handling in Java. Start with Sun's tutorial, http://java.sun.com/docs/books/tutorial/index.html, and you'll find something useful I'm sure.
Edit: In fact, http://onesearch.sun.com/search/clic...ve&col=javadoc is the page that covers event handling and graphics. Should be a good starting point. |
You should check out ActionListener and MouseListener as well.
|
stiLL stuck:(
i have checked out pages..but i am stiLL stuck with the action Listener event for giving the motions and movements..:(
|
Well, if you're looking for, lets say, a mouse click in a certain location to change the oven's color, then you could say, in the mouseClicked(Event e) method:
:
/* minX, maxX, minY, maxY for oven range are defined above*/That's somewhat how it should look. Of course, you'd have to define all those variables, and the changeColor() method. |
| All times are GMT -5. The time now is 12:57 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC