Say I have this class:
public class ExitView extends JPanel {
private static final long serialVersionUID = 1L;
public ExitView() {
JLabel title = new JLabel("Exit?");
title.setFont(new Font("Ariel", Font.PLAIN, 44));
this.add(title);
}
}
And this also:
public class EndView extends ExitView {
public ExitView() {
this.remove(title);
}
}
This code is stripped way down, but in my code this is not removing the JLabel in EndView
. I am able to just title.setText("")
but that's not really getting rid of it. Can anybody explain why it wouldn't remove the label? Thanks.