I'm using Swing and I'm trying to add some picture in program.
field = new JFormattedTextField(formatter);
ImageIcon icon = new ImageIcon("background.png"),
icon1 = new ImageIcon("1.png");
JLabel background = new JLabel(icon);
JLabel firstIcon = new JLabel(icon1);
JPanel center = new JPanel(new GridLayout(0, 1));
public void initComponents() {
this.getContentPane().add(center, BorderLayout.CENTER);
center.add(background);
field.setBounds(50,50);
background.add(field);
background.add(fristIcon);
}
With this code is everything working, but when I try to add the same picture "background.add(fristIcon);" again I don't see image added first. Every new image is deleting last icon.