I am currently working on a Black Jack game in Java. I am trying to work with Swing and I am stuck right now: I made this method
private void addImage(String path) {
JLabel imgLabel = new JLabel();
imgLabel.setIcon(new ImageIcon(getClass().getResource(path)));
add(imgLabel);
display.pack();
}
I want to have a reset button to restart after a round ends, how can I remove these unspecific JLabels? Should I give them an identifier? If yes how? Thanks in advance.