Results 1 to 11 of 11
- 01-14-2011, 12:08 AM #1
Member
- Join Date
- Jan 2011
- Posts
- 4
- Rep Power
- 0
java gui that moves image based on time
hey,
i have a requirement that basically requires a gui that will on button click show an image of a map. the map will have few train stations. ex: london, barcelona, lisbon, milan etc - let's assume train journey takes 1hour between each station starting from 9am till 9pm. so effectively what i want to show up on clicking the button is where the train is currently at showing a train pic/image of the map.
what classes would you suggest? so far i can only think of timer class to work out current time. how would i move the train image based on time? any ideas for this? other guidance will be appreciated.
oh yeh - what IDE would you suggest? ideallly i'd want something that will not require a big learning curve. i'm all new to java.
thank you all :D
- 01-14-2011, 12:40 AM #2
Also posted at the Oracle forums.
Do not do this as it is rude.
- 01-14-2011, 12:48 AM #3
Member
- Join Date
- Jan 2011
- Posts
- 2
- Rep Power
- 0
I don't see anything wrong with using more than one resource. That's like not being allowed to have a gmail account if you have a novel account. Or facebbok account if you have myspace.
Back to your question I would recommend eclipse. In my school we use jgrasp but eclipse is more user friendly and helps you understand the organization of your code by color coating and linking things together.
As far as the program go's I have never used images with my java since I am only an intermediate java programmer but I think you would have a separate image for the 12 hour time period linked to each hour or even one for every half an hour depending on how accurate you want to be. Then do it for the next 12 hours in the day if the train is still running during that time.
- 01-14-2011, 12:57 AM #4
Member
- Join Date
- Jan 2011
- Posts
- 2
- Rep Power
- 0
I can't give you an example at this time since I am in class and on an iPad but I'll try and post one when I get home. But another way it could be done is you can make the program pause or wait for a specific amount of time and then resume to the next part. I.e. Image at 9 wait for an hour image at 10.
- 01-14-2011, 01:20 AM #5
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,605
- Rep Power
- 5
Suggested reading for why cross-posting is frowned upon:The problems with crossposting
Originally Posted by OT20
-
Myself, I'll hold off on replying since I don't want to waste the OP's and my time duplicate replies given to the OP in a cross-post.
- 01-14-2011, 09:33 AM #7
Member
- Join Date
- Jan 2011
- Posts
- 4
- Rep Power
- 0
i did post elsewhere then came across this forum. i'll delete from the other place if they allow it. i did read the problem with cross posting and i can see why it can be a problem. my apologies :(
eclipse is it :)
- 01-15-2011, 09:07 PM #8
Member
- Join Date
- Jan 2011
- Posts
- 4
- Rep Power
- 0
have you used JSpinner class? it won't be using real time. real time in the app will only ever be 1hour. after 1hour it will set back to 0 and start again. in that time i need a way to show an image based on the time.
so if we start at station x (9:00am) and end up to next station, y at 9:10am) - if we imagine the app is running and the time is 9:10am - i want to show my image on station y. seems tricky to me...
-
I suggest you go into greater detail on your exact specification -- for instance, is this going to be an animation where the trains move and a clock advances? What exactly needs to be happening? What have you tried? What does JSpinner have to do with this? Any and all details are important.
- 01-15-2011, 11:41 PM #10
Member
- Join Date
- Jan 2011
- Posts
- 4
- Rep Power
- 0
hey,
i want a gui form that will have a button - 'track train' button. i also need a simple map that will appear showing the current real time position of the train
using maybe a red circle.
Requirements:
Timeframe used: 8am-9am
First train to leave station A is at 08:00. Last train is at 08:50
Estimated every 10mins (thus 6 trains will leave from station A)
So i want an application so that when a user presses the 'track train' button the map will indicate at what station the next train to reach station X is at, by the red circle.
For example - a user presses the button at 08:10 the map should idicate the red circle to be inbetween station A and station B.
I've not tired any code yet - i still don't know how i should start off with or what classes i might be able to utilise.
-
You would likely use Swing for the GUI and would probably do your drawing in the paintComponent method of a JPanel using Graphics and Graphics2D. The Java tutorials will show you how to do drawing with Swing. If you need animation, to see the train moving over time, then you'll need to use a Swing Timer. You can find the tutorials here: Really Big Index
Similar Threads
-
Rotating image based on the direction of a line
By YellowPainting in forum New To JavaReplies: 4Last Post: 08-06-2010, 08:32 AM -
Content Based Image Retrieval
By sanjay_jbp in forum AWT / SwingReplies: 1Last Post: 02-28-2010, 10:58 AM -
Bishops moves
By michail in forum New To JavaReplies: 5Last Post: 01-28-2010, 09:33 PM -
Web site Image Displays based on day of the week?
By foxdog175 in forum New To JavaReplies: 6Last Post: 04-15-2009, 12:21 AM -
non web based image verification integration
By therock in forum AWT / SwingReplies: 1Last Post: 01-10-2008, 11:22 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks