Skip to content

Commit 7e6caf7

Browse files
committed
Refactor: Button name and icon, remove GridPane, rowBox2 setMaxWidth
1 parent 40aa3c1 commit 7e6caf7

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadListPage.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ protected ModDownloadListPageSkin(DownloadListPage control) {
268268
HBox rowBox1 = new HBox(16);
269269
rowBox1.setAlignment(Pos.CENTER_LEFT);
270270
rowBox1.setMaxWidth(Double.MAX_VALUE);
271-
GridPane.setHgrow(rowBox1, Priority.ALWAYS);
272271

273272
JFXTextField nameField = new JFXTextField();
274273
HBox.setHgrow(nameField, Priority.ALWAYS);
@@ -280,28 +279,27 @@ protected ModDownloadListPageSkin(DownloadListPage control) {
280279
FXUtils.installFastTooltip(nameField, i18n("search.hint.english"));
281280
}
282281

283-
JFXButton btnExpend = FXUtils.newToggleButton4(SVG.ARROW_DROP_DOWN);
284-
btnExpend.setOnAction(e -> {
282+
JFXButton btnExpand = FXUtils.newToggleButton4(SVG.ARROW_DROP_DOWN);
283+
btnExpand.setOnAction(e -> {
285284
isExpanded.set(!isExpanded.get());
286-
btnExpend.setGraphic(isExpanded.get() ? FXUtils.newToggleButton4(SVG.ARROW_DROP_UP) : FXUtils.newToggleButton4(SVG.ARROW_DROP_DOWN));
285+
btnExpand.setGraphic(isExpanded.get() ? SVG.ARROW_DROP_UP.createIcon() : SVG.ARROW_DROP_DOWN.createIcon());
287286
});
288287

289288
if (control.versionSelection) {
290289
JFXComboBox<String> versionsComboBox = new JFXComboBox<>();
291290
versionsComboBox.setPrefWidth(200);
292291
Bindings.bindContent(versionsComboBox.getItems(), control.versions);
293292
selectedItemPropertyFor(versionsComboBox).bindBidirectional(control.selectedVersion);
294-
295-
rowBox1.getChildren().addAll(new Label(i18n("version")), versionsComboBox, new Label(i18n("mods.name")), nameField, btnExpend);
293+
rowBox1.getChildren().addAll(new Label(i18n("version")), versionsComboBox, new Label(i18n("mods.name")), nameField, btnExpand);
296294
} else {
297-
rowBox1.getChildren().addAll(new Label(i18n("mods.name")), nameField, btnExpend);
295+
rowBox1.getChildren().addAll(new Label(i18n("mods.name")), nameField, btnExpand);
298296
}
299297

300298
searchPane.getChildren().add(rowBox1);
301299

302300
HBox rowBox2 = new HBox(16);
303301
rowBox2.setAlignment(Pos.CENTER_LEFT);
304-
GridPane.setHgrow(rowBox2, Priority.ALWAYS);
302+
rowBox2.setMaxWidth(Double.MAX_VALUE);
305303

306304
rowBox2.visibleProperty().bind(isExpanded);
307305
rowBox2.managedProperty().bind(isExpanded);

0 commit comments

Comments
 (0)