Time delay problem in my Image viewing application

Hi all,

I am showing System Directory Tree in Jtree. The Images would be shown in JTable as like as ThumbNailView in windows if u r clicking some directory which has some image files. Abstract Table model is used for Jtable. I am filling the Scaled ImageIcon data in AbstractTable model while clicking the system directory, So scaled images are shown as a thumbnail view in Jtable whenever i clicked the system directory tree if it has image files.

Problems are.

1. It is taking long time to display the images after clicking Directory bcoz i am making scaled ImageIcon from the original file and filling into abstract table model. (Application is unresponsive while filing the data into Abstract Data model)

2. What could be the best solution to reduce the time delay if there are many image files, Say 300 ?

3. What could be the best solution to reduce the time delay if there are

some big files in terms of size, Say 100MB?

Thanks in advance,

Hack_Java.

[1012 byte] By [hack_javaa] at [2007-10-3 9:55:35]
# 1

Instead of using a JTable, I would start with a simple JPanel with a grid Layout (setup with N rows of 5 columns, for example);.

In this panel:

- When the user clicks on the directory: load the directory list into an array, empty the panel, then fill it with N * 5 empty labels (empty could mean showing an 'empty image' icon). After that, a thread can be used to define the icon for each label, by iterating thru the file list.

- If any selection event occurs while displaying the images, stop the thread and treat the action.

Hints for improvements:

- No need to display an image which is not visible.

- If the array is "pre-filled" with labels, it can be faster to update the labels than emptying & re-filling the panel.

Franck_Lefevrea at 2007-7-15 5:13:30 > top of Java-index,Desktop,Core GUI APIs...
# 2
Thank you.
hack_javaa at 2007-7-15 5:13:30 > top of Java-index,Desktop,Core GUI APIs...