Article View: borland.public.jbuilder.java.swing
Article #9400problems displaying an n x m table of images
From: Cees Pieters
Date: Sun, 09 Apr 2000 00:00
Date: Sun, 09 Apr 2000 00:00
44 lines
1918 bytes
1918 bytes
Hi there,
I am converting to JAVA from a Delphi background, and in order to learn
quickly I always force myself to write a game. To do this I want to
display an n x m matrix with GIF or JPG icons, which I must be able to
change.
I thought that I could use a JTable component to achive this, but I keep
drawing a blank. In my current construction, derived from the online
manual, I can fill any object, except my picture. I am using the
following:
DefaultTableModel snakePitModel = new DefaultTableModel() {
public int getColumnCount()
{
return ConfigurationClass.GetNrHorCells();
}
public int getRowCount()
{
return ConfigurationClass.GetNrVertCells();
}
public Object getValueAt(int row, int col)
{
return new ImageIcon("table.jpg");
}
};
JTable snakePitTable = new JTable(snakePitModel);
The eventual picture does display a string reference:
"javax.swing.ImageIcon@......."
but not the actual picture.
Another problem is, that I don't seem to get any methods to change the
images with this construction.
If anyone could help me on this one, either with the construction
depicted above, or a neater way to achieve the same, it would be greatly
appreciated!
Thanks!
Kees
Technical Details
Message-ID:
<38F08953.C45FE8EA@wxs.nl>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,4ff159c2976a8b73,start X-Google-Attributes: gid111d45,public From: Cees Pieters <cees_pieters@wxs.nl> Subject: problems displaying an n x m table of images Date: 2000/04/09 Message-ID: <38F08953.C45FE8EA@wxs.nl> X-Deja-AN: 608698969 Content-Transfer-Encoding: 7bit X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Trace: 9 Apr 2000 06:31:02 -0800, 195.121.211.90 Organization: World Access MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing