Im trying to make a java game where when the players health reaches 0 the game should end but currently when my progress bar reaches 0 nothing happens here is my code is there something wrong with it?
JProgressBar healthProgressBar = new JProgressBar();
lblHealth.setLabelFor(healthProgressBar);
healthProgressBar.setStringPainted(true);
healthProgressBar.setValue(100);
healthProgressBar.setMinimum(0);
healthProgressBar.setBounds(318, 103, 166, 20);
mainGame.add(healthProgressBar);
if(healthProgressBar.getValue() <= healthProgressBar.getMinimum())
{
frame5.setVisible(false);
frame7.setVisible(true);
}