Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 18th, 2005, 12:26 PM   #1
gonc
Newbie
 
Join Date: Dec 2004
Posts: 4
Rep Power: 0 gonc is on a distinguished road
Cool 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 thisthanx a Looott..

gonc..
gonc is offline   Reply With Quote
Old May 20th, 2005, 2:19 PM   #2
mackenga
Professional Programmer
 
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 317
Rep Power: 4 mackenga is on a distinguished road
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.
mackenga is offline   Reply With Quote
Old May 20th, 2005, 3:35 PM   #3
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
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
Mjordan2nd is offline   Reply With Quote
Old May 25th, 2005, 3:14 AM   #4
gonc
Newbie
 
Join Date: Dec 2004
Posts: 4
Rep Power: 0 gonc is on a distinguished road
Cool stiLL stuck:(

i have checked out pages..but i am stiLL stuck with the action Listener event for giving the motions and movements..
gonc is offline   Reply With Quote
Old May 28th, 2005, 12:02 AM   #5
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
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.
__________________
&quot;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.&quot; - Dwight D. Eisenhower
Mjordan2nd is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:52 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC