How do i get make the correctLabel to have all the text disappear so there is NO "correct" and the "buttonclicked values". I have been tryin but i can only manage to get the "correct" to dissapear the button clicked values are not removed
correctLabel.setText("Correct: " ); // this sets the label like so "correct:"
footer.add(new JLabel(buttonClicked.getText())); // when a button is clicked it takes the value and adds it to
the correctLabel like so "correct: 1, 2, 3"
when a user gets a answer wrong it takes away the "correct" so i am just left with 1,2,3the code i use to do this is
correctLabel.setText(" ");
i have tried correctLabel.setText("Correct: " - buttonClicked ); but this doesnt work. can someone help me understand the correct way of doing this.
i.e. correctLabel's text " "
full code
[code]
if (clickedNumber == (gui.buttonCounter + 1)) {
if (gui.buttonCounter == (gui.ROWS * gui.COLUMNS) - 1) {
gui.reset();
gui.correctLabel.setText("");
} else {
gui.buttonCounter++;
footer.add(new JLabel(buttonClicked.getText()));
buttonClicked.setText("");// optional - clears correct selection
correctLabel.setText("Correct: " - buttonClicked );
footer.revalidate();
if (gui.buttonCounter > gui.ROWS * gui.COLUMNS) {
gui.reset();
}
gui.statusLabel.setText("click" + gui.buttonCounter + "+1");
}
} else {
gui.reset();
gui.statusLabel.setText("start again ");
}
}
}[/code]