Adding image in JApplet
问题 ImageIcon icon= new ImageIcon("a.gif"); JLabel jLabel1=new JLabel(icon); jLabel1.setVisible(true); card1.add(jLabel1); I am a newbie to Java and I am facing a problem to add image in a panel in applet. My image is in the same folder. My applet is visible without any problem but only image is not displayed. 回答1: public void init() URL imageURL = new URL(getDocumentBase(), "a.gif"); Image image = getImage(imageURL); ImageIcon icon = new ImageIcon(image); // ... The ImageIcon constructor that