由于某种神秘的原因,它panel.add()
是红色的。在panel
上面初始化!
public class ShowImage {
ImageIcon image = new ImageIcon("D:/java.jpg");
JLabel label = new JLabel("sdasd", image, JLabel.CENTER);
JPanel panel = new JPanel(new BorderLayout());
panel.add(label, BorderLayout.CENTER);
}