我不知道为什么这不起作用。我想设置标签或文本的文本。 (无论哪个都起作用)。标签保持不变。当我使用Text时,应用程序崩溃了...
create procedure sp_ProcApps
@Cheque cheque readonly,
@Advances advance readonly
as
begin transaction
begin try
MERGE INTO apps_ AS application
USING @Cheque c ON application.appid= c.appid
WHEN MATCHED THEN
UPDATE
SET application.Reaudit=0,application.Id = c.id,application.status=6,application.closed=1;
MERGE INTO apps_ AS application1
USING @Advances adv ON application1.appid= adv.appid
WHEN MATCHED THEN
UPDATE
SET application1.reaudit=0,application1.status=6,application1.closed=1,application1.Id =14 ;
SELECT @IsOK='s'
COMMIT;
end TRY
BEGIN CATCH
SELECT @IsOK='f'
ROLLBACK;
END CATCH
它有2个参数。我尝试添加@FXML或删除@FXML,但两者均不起作用。我还尝试初始化标签和文本。
@FXML
public Text txtMessage;
@FXML
public Text txtTitle;
@FXML
public Text txtResult;
@FXML
public Label lblResult;
public void display(String title, String message) throws IOException {
txtResult = new Text();
lblResult = new Label();
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
Parent root= FXMLLoader.load(getClass().getResource("/Alertbox.fxml"));
lblResult.setText("message");
stage.setTitle(title);
stage.setScene(new Scene(root));
stage.show();
}
我调试了代码。 message是一个字符串,包含正确的消息。
答案 0 :(得分:0)
调用FXMLLoader.load
时不应创建控制器,因为load
将创建控制器。您也不应使用静态版本的加载。您的代码应该看起来像这样:
public static ControllerClass display(String title, String message) throws IOException {
Stage stage = new Stage();
stage.initModality(Modality.APPLICATION_MODAL);
FXMLLoader loader = new FXMLLoader();
Parent root= loader.load(getClass().getResource("/Alertbox.fxml"));
ControllerClass controller = loader.getController();
controller.lblResult.setText("message");
stage.setTitle(title);
stage.setScene(new Scene(root));
stage.show();
return controller;
}
这可能仍然不完全正确,但是它应该为您指明正确的方向。
请注意,ControllerClass是您的控制器的类名。