Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-13-2007, 10:56 PM
Member
 
Join Date: Jul 2007
Posts: 44
susan is on a distinguished road
Help with pictures en Java
Recently, I found that initialzing a new ImageIcon in the paint function is a terrible thing to do, as it will always look for the image which will slow the game down and/or flicker.
So the solution to this problem is to define the ImageIcon in the class, and call the picture in public void init or something.

However, would I have to do this process for 100++ pictures? I tried to use and array to load all my pictures, but then I had a problem finding the one I needed. Is there another solution to stop the game from being so slow/flickering?
Or just a better way to do this in general?
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-07-2007, 05:36 AM
Member
 
Join Date: Jul 2007
Posts: 40
cachi is on a distinguished road
Can you associate the pictures with some type of string?
Such as the filename or something of that sort?
That way you can look it up in a hashmap which will give you as close as O(1) time as you're going to get.
There is also included a way to get the entrySet from the hashmap if you need to go through each of them.
This is included in the API:
HashMap

Basically I think you need to look into ways to optimizing the whole thing. It may be worth wild to do a search on Google about optimizing java code. Besides that without looking at the code I can't tell you much else about it.

Greetings.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
The Funny Pictures Thread(this means a lot of pictures...) joshua Jokes and Funny Things 9 07-10-2008 12:28 PM
Help Loading Up Pictures marco Java Applets 3 08-14-2007 11:32 PM


All times are GMT +3. The time now is 09:01 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org