Results 1 to 12 of 12
  1. #1
    Join Date
    Jun 2008
    Posts
    54
    Rep Power
    0

    Default every weak 4 images comes,

    Actually i want to display images in my application. So every weak 4 images comes ,weak wise images change. So give me logic or code in java .

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    You'll have to show your code for anyone to be able to suggest how to change it to show the new images.
    One solution would be to list the images to be shown in a file and have the app read the file to get the names of the images to be shown.

  3. #3
    Join Date
    Jun 2008
    Posts
    54
    Rep Power
    0

    Default Help

    Quote Originally Posted by Norm View Post
    You'll have to show your code for anyone to be able to suggest how to change it to show the new images.
    One solution would be to list the images to be shown in a file and have the app read the file to get the names of the images to be shown.
    but how to get it week wise.After each 7 day images change.

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Use a swing timer to change image. Set the timer to 7 days and load the image into the required place.

  5. #5
    Supamagier is offline Senior Member
    Join Date
    Aug 2008
    Posts
    384
    Rep Power
    6

    Default

    Or use a thread, or just use date, it all works. You should google for the 'correct' code.
    I die a little on the inside...
    Every time I get shot.

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  7. #7
    Supamagier is offline Senior Member
    Join Date
    Aug 2008
    Posts
    384
    Rep Power
    6

    Default

    For once every seven days I would choose to compare the date every now and then. ;) I think that would be best - least memory-consuming, but I may be wrong, correct me if so. :)
    I die a little on the inside...
    Every time I get shot.

  8. #8
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default

    So every weak 4 images comes
    How does the program access the images? Are they in a folder with all the previous images? What controls where the new images are placed?

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by Supamagier View Post
    For once every seven days I would choose to compare the date every now and then. ;) I think that would be best - least memory-consuming, but I may be wrong, correct me if so. :)
    So you may use a thread there. Basically you have to keep track of seven days anyhow, throw a thread or anything. Memory managements are based on your implementations. Actually Java done the most of it for you.

  10. #10
    Supamagier is offline Senior Member
    Join Date
    Aug 2008
    Posts
    384
    Rep Power
    6

    Default

    True, I just thought of the fact that you had to check it every now and then, and needed a timer for that anyways, so, indeed, it doesn't really matter what you use, although I prefer Threads.
    I die a little on the inside...
    Every time I get shot.

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    I think so, threads are much safer. But if you are dealing with in GUI implementation swing timer could be better too.

  12. #12
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Normal good design practice is to set a thread with a wakeup (sleep()) time that wakes up before your deadline. Wake up, see if the deadline has passed, if not sleep for 75% more.

    This way, if your code dies or if the timers are off a bit, you can be safe.

    This is also a good time to check that your computer is using a NTP pool server for time.

Similar Threads

  1. XML Images
    By JavaWizz in forum XML
    Replies: 1
    Last Post: 10-17-2008, 10:19 AM
  2. images
    By amith in forum AWT / Swing
    Replies: 3
    Last Post: 06-27-2008, 08:38 PM
  3. images
    By amith in forum AWT / Swing
    Replies: 1
    Last Post: 05-20-2008, 10:54 AM
  4. Help with images...
    By toby in forum Java Applets
    Replies: 1
    Last Post: 08-04-2007, 05:25 AM
  5. Images in JSP
    By Daniel in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 06-05-2007, 06:01 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
  •