Lost Password?


Go Back   CodeCall Programming Forum > Software Development > Java Help

Java Help Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-25-2008, 02:17 PM
Roders1234 Roders1234 is offline
Newbie
 
Join Date: Nov 2007
Posts: 4
Rep Power: 0
Roders1234 is on a distinguished road
Default Circular movement in java?

Hey there everyone.

I'm wondering how I would show an object moving in a circle, around a fixed point in a java applet. Can anyone help me?

Thanks, Rod
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 02-25-2008, 02:26 PM
Arkie Arkie is offline
Learning Programmer
 
Join Date: Dec 2007
Posts: 84
Rep Power: 4
Arkie is on a distinguished road
Send a message via MSN to Arkie
Default

Quote:
Originally Posted by Roders1234 View Post
Hey there everyone.

I'm wondering how I would show an object moving in a circle, around a fixed point in a java applet. Can anyone help me?

Thanks, Rod
Well, however you are drawing your stuff on your applet just change the coordinates.
__________________
My personal Java blog with open source software
My open source messenger!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-25-2008, 02:46 PM
Roders1234 Roders1234 is offline
Newbie
 
Join Date: Nov 2007
Posts: 4
Rep Power: 0
Roders1234 is on a distinguished road
Default

Quote:
Originally Posted by Arkie View Post
Well, however you are drawing your stuff on your applet just change the coordinates.
I've thought about doing it that way but im going to have about 10 different moving objects, all with different radii and moving at different speeds.
The only logical way i can think of doing this at the moment is to store a selection of the x, y coordinates of each circle in a database and then just have java move each object 'so many' points at each interval.

Am I just being naive?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-25-2008, 04:42 PM
Arkie Arkie is offline
Learning Programmer
 
Join Date: Dec 2007
Posts: 84
Rep Power: 4
Arkie is on a distinguished road
Send a message via MSN to Arkie
Default

Without seeing any code im unable to tell how the architecture of your design is.

What you can do is create a method that takes one parameter as a basepoint and another one for degrees.

You should also be using threads because of the 10 different objects moving at the same time (i assume)
__________________
My personal Java blog with open source software
My open source messenger!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-25-2008, 05:34 PM
gszauer's Avatar   
gszauer gszauer is offline
Programmer
 
Join Date: Nov 2007
Location: Florida
Age: 19
Posts: 113
Rep Power: 4
gszauer is on a distinguished road
Default

Java5 Code:
  1. interface CircularMovement {
  2.   public void moveCircle (Point center, int radius, int speed);
  3.   public void setCenter (Point center);
  4.   public void setRadius (int radius);
  5.   public void setSpeed (int speed);
  6.   public void serCenter (int x, int y);
  7. }

Java5 Code:
  1. public class YourClass implements CircularMovement {
  2.   ...

Give each object a method that moves it in a circle. That way you can manipulate each object individually by calling one of its functions.
__________________
Quote:
Originally Posted by ~Aristotle
It is the mark of an educated mind to entertain a tought without accepting it
If my post was helpful, please help me build some rep
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Cursors using Java gszauer Java Tutorials 0 12-02-2007 11:25 AM
MS-SQL deadlock and hang the Java application reachpradeep Database & Database Programming 1 03-11-2007 05:20 AM
Java Facts techni68 Java Help 0 01-17-2007 02:41 PM
John's Java Tutorial Index John Java Tutorials 0 01-11-2007 04:05 PM
Java Help Files xXHalfSliceXx Java Help 3 11-29-2006 12:30 AM


All times are GMT -5. The time now is 03:03 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads