求解0 0关于swing JFrame 里面的remove和add函数
ImageIcon image = new ImageIcon("C:\\myworkspace\\catchhtmlpic\\google.png"); this.getContentPane().remove(img1); img1 = new JLabel(image);// put pic in img1。 add(img1, BorderLayout.CENTER); this.pack(); ImageIcon image = null; if(loadpicFlag) image = new ImageIcon("C:\\myworkspace\\catchhtmlpic\\google.png"); else image = new ImageIcon("C:\\myworkspace\\catchhtmlpic\\aaaaa.png"); loadpicFlag = !loadpicFlag; this.getContentPane().remove(img1); img1 = new JLabel(image);// put pic in img1。 add(img1, BorderLayout.CENTER); this.pack();