Results 1 to 2 of 2

Thread: [RESOLVED] Images not showing :'(

Threaded View

  1. #1

    Thread Starter
    Frenzied Member oceanebelle's Avatar
    Join Date
    Jun 2005
    Location
    my n00k.
    Posts
    1,064

    Resolved [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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width