Skip to content

Commit 310feb4

Browse files
committed
在陶瓦联机页面添加切换账号菜单
1 parent 000a737 commit 310feb4

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

HMCL/src/main/java/org/jackhuang/hmcl/ui/terracotta/TerracottaPage.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
package org.jackhuang.hmcl.ui.terracotta;
1919

20+
import com.jfoenix.controls.JFXPopup;
2021
import javafx.beans.property.ReadOnlyObjectProperty;
2122
import javafx.beans.property.ReadOnlyObjectWrapper;
2223
import javafx.beans.value.ChangeListener;
@@ -33,6 +34,7 @@
3334
import org.jackhuang.hmcl.ui.FXUtils;
3435
import org.jackhuang.hmcl.ui.SVG;
3536
import org.jackhuang.hmcl.ui.account.AccountAdvancedListItem;
37+
import org.jackhuang.hmcl.ui.account.AccountListPopupMenu;
3638
import org.jackhuang.hmcl.ui.animation.TransitionPane;
3739
import org.jackhuang.hmcl.ui.construct.*;
3840
import org.jackhuang.hmcl.ui.decorator.DecoratorAnimatedPage;
@@ -72,12 +74,12 @@ public TerracottaPage() {
7274

7375
AccountAdvancedListItem accountListItem = new AccountAdvancedListItem();
7476
accountListItem.setOnAction(e -> Controllers.navigate(Controllers.getAccountListPage()));
75-
// accountListItem.setOnMouseClicked(e -> {
76-
// if (e.getButton() == MouseButton.SECONDARY) {
77-
// showAccountListPopupMenu(accountListItem);
78-
// e.consume();
79-
// }
80-
// });
77+
accountListItem.setOnMouseClicked(e -> {
78+
if (e.getButton() == MouseButton.SECONDARY) {
79+
AccountListPopupMenu.show(accountListItem, JFXPopup.PopupVPosition.BOTTOM, JFXPopup.PopupHPosition.LEFT, accountListItem.getWidth(), 0);
80+
e.consume();
81+
}
82+
});
8183
accountListItem.accountProperty().bind(Accounts.selectedAccountProperty());
8284

8385
AdvancedListBox toolbar = new AdvancedListBox()

0 commit comments

Comments
 (0)