Hi,
I have a jFrame with a couple of jLabels, designed in Netbeans so most of the code is generated.
If I want to change the text of the label, I use .setText() inside my jFrame and it works great.
Now here's the problem. If I just make a String in a new class, I want this to appear on my jLabel.
I have the following code snippets:
GUI.java (jFrame):
public void setjLabel_answer(String jLabeltext) {
jLabel_answer.setText(jLabeltext);
System.out.println(jLabeltext);
}
Spel.java:
GUI window = new GUI();
window.setjLabel_answer("hello world");
So I get the output "test" thanks to system.out.println, but the label doesn't change text?? :( When I use jLabel_answer.setText("test") inside my jFrame, it works great... I have a feeling this is maybe a downcast problem? It seems so simple, but I have no clue at the moment