Results 1 to 11 of 11
  1. #1
    androidsm is offline Member
    Join Date
    Jan 2011
    Posts
    4
    Rep Power
    0

    Default 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

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default

    Also posted at the Oracle forums.

    Do not do this as it is rude.

  3. #3
    OT2O is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

    Default

    Quote Originally Posted by Junky View Post
    Also posted at the Oracle forums.

    Do not do this as it is rude.
    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.

  4. #4
    OT2O is offline Member
    Join Date
    Jan 2011
    Posts
    2
    Rep Power
    0

    Default

    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.

  5. #5
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    6

    Default

    Quote Originally Posted by OT20
    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.
    Suggested reading for why cross-posting is frowned upon:The problems with crossposting

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    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.

  7. #7
    androidsm is offline Member
    Join Date
    Jan 2011
    Posts
    4
    Rep Power
    0

    Default

    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 :)

  8. #8
    androidsm is offline Member
    Join Date
    Jan 2011
    Posts
    4
    Rep Power
    0

    Default

    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...

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    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.

  10. #10
    androidsm is offline Member
    Join Date
    Jan 2011
    Posts
    4
    Rep Power
    0

    Default

    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.

  11. #11
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    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

  1. Rotating image based on the direction of a line
    By YellowPainting in forum New To Java
    Replies: 4
    Last Post: 08-06-2010, 08:32 AM
  2. Content Based Image Retrieval
    By sanjay_jbp in forum AWT / Swing
    Replies: 1
    Last Post: 02-28-2010, 10:58 AM
  3. Bishops moves
    By michail in forum New To Java
    Replies: 5
    Last Post: 01-28-2010, 09:33 PM
  4. Web site Image Displays based on day of the week?
    By foxdog175 in forum New To Java
    Replies: 6
    Last Post: 04-15-2009, 12:21 AM
  5. non web based image verification integration
    By therock in forum AWT / Swing
    Replies: 1
    Last Post: 01-10-2008, 11:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •