Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Moving objects

Posted on 2007-03-27
3
Medium Priority
?
221 Views
Last Modified: 2013-11-23
How would I code to move a circle,triangle internal to my GUI, all by itself?

Also, how would I code a key on the keyboard to make that object move?
0
Comment
Question by:jmurguia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Assisted Solution

by:kawas
kawas earned 1000 total points
ID: 18800183
http://kawigi.yajags.com/animation/ has some source code with some good examples.
0
 
LVL 13

Assisted Solution

by:kawas
kawas earned 1000 total points
ID: 18800187
basically, you create a shape and using a timer, move the shape when the time is right. As for the keyboard, add a listener to perform whatever action you wish when you press the key
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 1000 total points
ID: 18800219
If you want to move the object upon key press you will need to do that in the keyPress event - you'll need a KeyListener for that. I guess the timer is not needed in that case, if you want to do it only on key-press but not on regular intervals - you will get some sample code here:

http://forum.java.sun.com/thread.jspa?threadID=5146827&messageID=9546374

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question