how do i create new JLabel() dynamically in a while loop, and add to a JPanel by using the setBounds method. The setBounds work, however, there are other JLabel added to other place. why is this happen?
while(condition){
pin = new JLabel();
pin.setIcon(pinIcon);
pin.setBounds(Panel1.getImgX(), Panel1.getImgY(), 20, 30);
Panel1.panel.add(pin);
}