I need a label
to receive text automatically as soon as stage
is started, without having to click a button.
Because different texts are saved in a database, they need to be loaded into the label when stage
starts.
Is there a method for this?
This is the controller class of the application:
public class DesafioController {
@FXML Button btnCancelar = new Button();
@FXML TextArea AreaSolucao = new TextArea();
@FXML Label labelDesafio = new Label();
@FXML AnchorPane pane = new AnchorPane();
@FXML
void clickRecomecar() {
//Reinicia o desafio do zero, apagando o que já foi escrito.
AreaSolucao.setText("TESTE RECOMEÇAR");
}
@FXML
void clickCancelar() {
//Fecha o desafio voltando para o jogo.
Stage atual = (Stage) btnCancelar.getScene().getWindow();
atual.close();
}
@FXML
void clickEnviar() {
//Aqui será enviado a solução do desafio para o banco de dados.(INSERT)
}
}
Application window: