Skip to content

Commit 34a3361

Browse files
committed
删除AccountMenuItem, 修改高度设置, 修复账号名称显示
1 parent d0d3f19 commit 34a3361

File tree

3 files changed

+11
-84
lines changed

3 files changed

+11
-84
lines changed

HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountAdvancedListItem.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,19 @@ public AccountAdvancedListItem() {
7474
canvas = new Canvas(32, 32);
7575
setLeftGraphic(canvas);
7676

77+
setActionButtonVisible(false);
78+
7779
FXUtils.onScroll(this, Accounts.getAccounts(),
7880
accounts -> accounts.indexOf(account.get()),
7981
Accounts::setSelectedAccount);
8082
}
8183

84+
public AccountAdvancedListItem(Account account) {
85+
this();
86+
this.accountProperty().set(account);
87+
setOnScroll(null);
88+
}
89+
8290
public ObjectProperty<Account> accountProperty() {
8391
return account;
8492
}

HMCL/src/main/java/org/jackhuang/hmcl/ui/account/AccountMenuItem.java

Lines changed: 0 additions & 81 deletions
This file was deleted.

HMCL/src/main/java/org/jackhuang/hmcl/ui/main/RootPage.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
import org.jackhuang.hmcl.ui.FXUtils;
3838
import org.jackhuang.hmcl.ui.SVG;
3939
import org.jackhuang.hmcl.ui.account.AccountAdvancedListItem;
40-
import org.jackhuang.hmcl.ui.account.AccountMenuItem;
4140
import org.jackhuang.hmcl.ui.animation.AnimationUtils;
4241
import org.jackhuang.hmcl.ui.construct.AdvancedListBox;
4342
import org.jackhuang.hmcl.ui.construct.AdvancedListItem;
@@ -258,10 +257,11 @@ public void showAccountListPopupMenu(
258257
JFXPopup popup = new JFXPopup(popupMenu);
259258
AdvancedListBox scrollPane = new AdvancedListBox();
260259
scrollPane.setPrefWidth(220);
261-
scrollPane.setPrefHeight(260);
260+
scrollPane.setPrefHeight(-1);
261+
scrollPane.setMaxHeight(260);
262262

263263
for (Account account : Accounts.getAccounts()) {
264-
AccountMenuItem item = new AccountMenuItem(account);
264+
AccountAdvancedListItem item = new AccountAdvancedListItem(account);
265265
item.setOnAction(e -> {
266266
Accounts.setSelectedAccount(account);
267267
popup.hide();

0 commit comments

Comments
 (0)