|
-
Aug 8th, 2005, 01:32 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Images not showing :'(
Code:
class GoBangTile extends JComponent{
private final static Image imgDisplay[] = new Image[3];
protected final static int IMG_NASHI;
protected final static int IMG_MARU;
protected final static int IMG_BATSU;
private int bImgType;
static{
IMG_NASHI = 0;
IMG_MARU = 1;
IMG_BATSU = 2;
imgDisplay[IMG_NASHI] = new ImageIcon("nashi.PNG").getImage();
imgDisplay[IMG_MARU] = new ImageIcon("maru.PNG").getImage();
imgDisplay[IMG_BATSU] = new ImageIcon("batsu.PNG").getImage();
}
protected GoBangTile(){
System.out.println("Doing tile, getting images");
bImgType = IMG_NASHI;
this.setPreferredSize(new Dimension(100, 100));
this.setSize(new Dimension(100, 100));
}
protected void setImage(int bNewImageType){
if(bNewImageType <= 2 && bNewImageType >= 0){
bImgType = bNewImageType;
}
repaint();
}
/* (non-Javadoc)
* @see java.awt.Component#paint(java.awt.Graphics)
*/
public void paint(Graphics g) {
// TODO Auto-generated method stub
//Graphics2D g2d = (Graphics2D)g;
//g2d.drawImage(imgDisplay[bImgType], 0, 0, this);
g.drawImage(imgDisplay[bImgType], 0, 0, this);
super.paint(g);
}
}
somehow, the images are not showing... but I know the elements have been added. what could be wrong???
Last edited by oceanebelle; Aug 8th, 2005 at 01:40 AM.
-
Aug 8th, 2005, 01:53 AM
#2
Thread Starter
Frenzied Member
Re: Images not showing :'(
LOL, nevermind.. found the solution... wrong place for the location of the images... i thought it would search for images where the classes are located.. but now I changed it to the project location so its fine..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|