I have a GUI screen, and it has a label in it. I now want to set the label with a text as i have shown in below (Test
). But it\'s not getting updated. I think t
In your mainScreen()
you create a new FrameTest
that is distinct from the one you create in the main
routine, so it's actually changing the text, of the invisible frame. Try this instead:
private FrameTest frame = this;
public void mainScreen() {
EventQueue.invokeLater(new Runnable() {
public void run() {
frame.setVisible(true);
}
});
}
Or simply:
public void mainScreen() {
EventQueue.invokeLater(new Runnable() {
public void run() {
setVisible(true);
}
});
}