in my code i need to set a icon in a table but just see the url of icon in cell
public void listread(){
ImageIcon hpi = new ImageIcon("D:\\workspace\\1.ico");
connectionQuery();
try{
Statement stm = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet rss = stm.executeQuery("SELECT idusers, username, usertype, userpass FROM maindb.users");
while(rss.next()){
idusers = rss.getInt("idUsers");
username = rss.getString("username");
userval = rss.getInt("usertype");
userpass = rss.getInt("userpass");
if(userpass > 0){
model.addRow(new Object[]{idusers, username, userval, hpi.getImage()});
}else{
model.addRow(new Object[]{idusers, username, userval});
}
System.out.println(String.format("%s - %s - %s - %s", idusers, username, userval, userpass));
}
con.close();
}catch(Exception e1){
System.out.println(e1);
}
}
so hpi
is my icon and if use it return icon physical url(D:\workspace\1.ico) and if use hpi.getimage()
then return memory url(sun.awt.image.ToolkitImage@20b62cf9) of icon