Ok, I'll wait for the small, complete program before making any further posts here.
Type: Posts; User: Norm
Ok, I'll wait for the small, complete program before making any further posts here.
What is the variable name of "the label" that you are talking about?
I thought that was what you wanted in the label.
Without a small, complete program that compiles, executes and shows the...
Something like this:
get value from buttonClicked into x
get value from label??? into y
concatenate x to end of y: y = y + x
set value for label??? from new value of y
Use concatenation so the display will be:
1
then
12
then
123
then
1234
etc
Use the String concatenation operator:
String x = "1"; // define x and give it a value of "1"
x = x + "2"; // now x has value of "12"
Are you asking how to concatenate a new String to the end of the String currently being shown?
Then see posts #29 and end of #37
An example of what?
Here's how to set the value of correctLabel from the value in buttonClicked:
correctLabel.setText(buttonClicked.getText());
If you need more: make and post a SMALL,...
Then use the variable: correctLabel to show the results. Don't create a new JLabel.
The fix for that statement is to remove it:
// footer.add(new JLabel(buttonClicked.getText()));
so that it does NOT add a new JLabel.
What one line of code? Please post the line of code that you are asking about.
Can you make and post a SMALL, simple program that compiles, executes and shows the problem?
Don't create new labels, reuse the existing ones.
New labels without reference variables are hard to access if you want to change their values.
Execute this code:
correctLabel.setText(" ");
Is the program executing that code? If not, why isn't it?
What are the values of the variables used in the if statement that controls if that...
Sorry, that last post does not make sense. Labels don't interact. It's the code that makes changes to labels.
What do you expect to be in each label AFTER that code executes?
Give the name...
Did you have a question or comment?
If the statement is not executed, the label is not cleared. Is the if statement true?
if (gui.buttonCounter > gui.ROWS * gui.COLUMNS) {
Add a println() statement to show the values used in...
You have this:
gui.correctLabel.setText("");