小编Cou*_*osh的帖子

为 Swaggo 设置 @Failure 注释示例

我正在使用 Swaggo 来编写 API 文档,并且正在努力添加请求结果的示例(更准确地说,是失败的结果)。

这是我的一条路径的代码:

// @Summary Modification of a leave
// @Description Modification of a leave
// @Tags Leave
// @Accept  json
// @Produce  plain
// @Param modifLeaveRequest body ModifLeaveRequest true "Request to modify a leave"
// @Param leave_id path int true "Leave ID"
// @Success 200 {boolean} boolean "true"
// @Failure 400 {string} string "error in the fields"
// @Failure 401 {string} string "wrong login"
// @Failure 409 {string} string "the leave cannot be modified"
// @Failure …
Run Code Online (Sandbox Code Playgroud)

go swagger

11
推荐指数
1
解决办法
1918
查看次数

如何在边框底部的每个角落放置两个按钮

我正在尝试放两个不同的按钮,一个在左下角,另一个在右下角.这两个按钮是不同的HBox,两个HBox是在底部Borderpane

要做到这一点,我做到了这一点,它有效,但它是丑陋的:

envoisButton = new Button("Envoyer la commande");
envoisButton.setStyle("-fx-font: 20px \"Roboto\";");
envoisButton.setPrefSize(300,50);
envoisButton.setGraphic(new ImageView(new Image("PleinVide/images/OK.png")));
HBox.setMargin(envoisButton,new Insets(0,20,20,20));
HBox rightButtons = new HBox(envoisButton);
rightButtons.setAlignment(Pos.CENTER_RIGHT);

synchroButton = new Button("Synchroniser");
synchroButton.setStyle("-fx-font: 20px \"Roboto\";");
synchroButton.setPrefSize(300,50);
synchroButton.setGraphic(new ImageView(new Image("PleinVide/images/synchronize.png")));
HBox.setMargin(synchroButton,new Insets(0,20,20,20));
HBox leftButtons = new HBox(synchroButton);
leftButtons.setAlignment(Pos.CENTER_LEFT);
HBox buttons = new HBox(leftButtons,rightButtons);
buttons.setSpacing(primaryScreenBounds.getWidth()*0.65); //This is very ugly (primaryScreenBounds == my screen resolution)

borderPane.setBottom(buttons);
Run Code Online (Sandbox Code Playgroud)

这是结果: 预期的按钮位置 我们可以看到2个按钮是我想要它们的位置,但如果将来我想添加另一个按钮,这根本不起作用:/

你有解决方案将两个按钮放在角落吗?非常感谢你.

java javafx

1
推荐指数
1
解决办法
364
查看次数

标签 统计

go ×1

java ×1

javafx ×1

swagger ×1