ivanthepro
asked on
JSwing - JTable
I went to Java Web Start 1.2, to take a look at the swing set demo. There you can see an example on JTables. It displays a custom table which excepts an ImageIcon.
I looked at its source code and it says this:
ImageIcon strawberry = createImageIcon(...);
...
...
...
Objects[][] data = {{.........,strawberry},{. ..}}
from the api there is no such method as createImageIcon(...). So I presume its extended from the demomodule, can anyone tell me how this method is written? I tried to use all methods like setting the ImageObserver etc but none seems to match to the example in this swingset
Anyone can help pls?
TIA
Ivan
I looked at its source code and it says this:
ImageIcon strawberry = createImageIcon(...);
...
...
...
Objects[][] data = {{.........,strawberry},{.
from the api there is no such method as createImageIcon(...). So I presume its extended from the demomodule, can anyone tell me how this method is written? I tried to use all methods like setting the ImageObserver etc but none seems to match to the example in this swingset
Anyone can help pls?
TIA
Ivan
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
is there anything wrong with my codes? i've never used swingsets before .. i'm a newbie .. hehehe ..
objects:
from your codes .. it seems like it's a method that returns an imageicon ..
ImageIcon strawberry = new ImageIcon("filename");
-------------------------- ---------- ---------- ---------- --
String path = "/resources/images/" + filename;
return new ImageIcon(getClass().getRe source(pat h), description);
don't they end up doing the same thing?
:)
-=[sKySh@DoW]=-
objects:
from your codes .. it seems like it's a method that returns an imageicon ..
ImageIcon strawberry = new ImageIcon("filename");
--------------------------
String path = "/resources/images/" + filename;
return new ImageIcon(getClass().getRe
don't they end up doing the same thing?
:)
-=[sKySh@DoW]=-
Similiar though a bit different how they locate file.
Your code loads the image from a file directly.
The SwingSet code loads it from a URL, plus the named image needs to be accessible by the classloader.
(Plus you're doesn't set the description).
Your code loads the image from a file directly.
The SwingSet code loads it from a URL, plus the named image needs to be accessible by the classloader.
(Plus you're doesn't set the description).
objects:
thks for that ..
by the way .. i was too lazy to type the description part .. hheeeehhee
thks
:)
-=[sKySh@DoW]=-
thks for that ..
by the way .. i was too lazy to type the description part .. hheeeehhee
thks
:)
-=[sKySh@DoW]=-
ASKER
i tried all of your methods, but it seems like the JTable only displays the url instead of the pic?
ASKER
sorry, my mistake...
okok you are correct
okok you are correct
ImageIcon strawberry = new ImageIcon("filename");
:)
-=[sKySh@DoW]=-