![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Dec 2004
Posts: 4
Rep Power: 0
![]() |
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.. |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 314
Rep Power: 4
![]() |
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. |
|
|
|
|
|
#3 |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
You should check out ActionListener and MouseListener as well.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Dec 2004
Posts: 4
Rep Power: 0
![]() |
i have checked out pages..but i am stiLL stuck with the action Listener event for giving the motions and movements..
![]() |
|
|
|
|
|
#5 |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
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*/
int xLoc = e.getX();
int yLoc = e.getY();
if(x > minX && x<maxX && y>minY && y < maxY)
{
changeColor();
}That's somewhat how it should look. Of course, you'd have to define all those variables, and the changeColor() method.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|