Skip to content

Comments

将 JFXTextField 右键菜单改为 JFX 样式#5292

Merged
Glavo merged 11 commits intoHMCL-dev:mainfrom
CiiLu:运帷幄英雄几拂袖阴谋阳谋明仇暗斗化作一江浊浪东流
Jan 25, 2026

Hidden character warning

The head ref may contain hidden characters: "\u8fd0\u5e37\u5e44\u82f1\u96c4\u51e0\u62c2\u8896\u9634\u8c0b\u9633\u8c0b\u660e\u4ec7\u6697\u6597\u5316\u4f5c\u4e00\u6c5f\u6d4a\u6d6a\u4e1c\u6d41"
Merged

将 JFXTextField 右键菜单改为 JFX 样式#5292
Glavo merged 11 commits intoHMCL-dev:mainfrom
CiiLu:运帷幄英雄几拂袖阴谋阳谋明仇暗斗化作一江浊浪东流

Conversation

@CiiLu
Copy link
Contributor

@CiiLu CiiLu commented Jan 23, 2026

@3gf8jv4dv
Copy link
Contributor

密码字段框的菜单没覆盖。

Image

@3gf8jv4dv
Copy link
Contributor

游戏窗口分辨率字段的菜单没覆盖。

Image

@3gf8jv4dv
Copy link
Contributor

导出整合包时的描述填写区字段,菜单没有覆盖。

Image

@3gf8jv4dv
Copy link
Contributor

「设置 > 外观 > 背景图片 > 网络」试图唤起菜单时,启动器崩溃。
主线分支可正常唤出菜单。

Image
---- Hello Minecraft! Crash Report ----
  Version: 3.11.unofficial-8ad0792
  Time: 2026-01-23 17:09:50
  Thread: Thread[#35,JavaFX Application Thread,5,main]

  Content: 
    java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because the return value of "javafx.scene.control.TextField.getText()" is null
	at org.jackhuang.hmcl.ui.FXUtils.lambda$useJFXContextMenu$32(FXUtils.java:1642)
	at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
	at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.graphics/javafx.scene.Scene.processMenuEvent(Scene.java:1989)
	at javafx.graphics/javafx.scene.Scene$ScenePeerListener.menuEvent(Scene.java:2807)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMenuEvent$0(GlassViewEventHandler.java:419)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMenuEvent(GlassViewEventHandler.java:399)
	at javafx.graphics/com.sun.glass.ui.View.handleMenuEvent(View.java:586)
	at javafx.graphics/com.sun.glass.ui.win.WinView.notifyMenu(WinView.java:108)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$0(WinApplication.java:173)
	at java.base/java.lang.Thread.run(Thread.java:1474)


-- System Details --
  Operating System: Windows 11 25H2 10.0.26200.7627
  System Architecture: x86-64
  Java Architecture: x86-64
  Java Version: 25.0.2, BellSoft
  Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), BellSoft
  JVM Max Memory: 
  JVM Total Memory: 
  JVM Free Memory: 

@3gf8jv4dv
Copy link
Contributor

3gf8jv4dv commented Jan 23, 2026

「设置 > 通用 > 下载 > 代理」的四个字段框也会崩,和上面的崩溃报告几近相同。

编辑:发现只有字段为空时会崩溃,有内容时不会。

@3gf8jv4dv
Copy link
Contributor

「账户列表 > 上传/编辑皮肤 > 本地皮肤图片文件 / Blessing Skin 服务器」的字段框也会崩,日志和上面几近相同。

@zkitefly
Copy link
Member

zkitefly commented Jan 24, 2026

image

这个分支名没问题吧(
依稀记得设置成中文可能会出事?

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request replaces the default JavaFX context menus in text input controls (JFXTextField, JFXTextArea, JFXPasswordField, and editable JFXComboBox) with custom JFX-styled context menus. The implementation provides a consistent Material Design look for right-click menus across text input controls.

Changes:

  • Added internationalization strings for context menu items (undo, redo, cut, copy, paste, delete, select all) in English, Simplified Chinese, and Traditional Chinese
  • Created new JFX control classes (JFXTextField, JFXTextArea, JFXPasswordField, JFXComboBox) with custom context menu integration
  • Added new SVG icons (CONTENT_CUT, CONTENT_PASTE, REDO, UNDO) and CSS styling for popup menu scrollbars

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 20 comments.

Show a summary per file
File Description
I18N.properties, I18N_zh.properties, I18N_zh_CN.properties Added internationalized strings for context menu items
root.css Added CSS styling to hide scrollbars in popup menus
PopupMenu.java Updated scroll pane initialization (introduces redundant code)
SVG.java Added SVG path definitions for new menu icons
FXUtils.java Added useJFXContextMenu utility method and organized imports
JFXTextField.java New control class with JFX-styled context menu
JFXTextArea.java New control class with JFX-styled context menu
JFXPasswordField.java New control class with JFX-styled context menu (contains issues)
JFXComboBox.java New control class with JFX-styled context menu for editable mode (contains critical issue)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@3gf8jv4dv 3gf8jv4dv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm :shipit:

@Glavo Glavo merged commit c06f898 into HMCL-dev:main Jan 25, 2026
2 checks passed
@CiiLu CiiLu deleted the 运帷幄英雄几拂袖阴谋阳谋明仇暗斗化作一江浊浪东流 branch January 25, 2026 08:04
@CiiLu CiiLu restored the 运帷幄英雄几拂袖阴谋阳谋明仇暗斗化作一江浊浪东流 branch January 25, 2026 12:26
@CiiLu CiiLu deleted the 运帷幄英雄几拂袖阴谋阳谋明仇暗斗化作一江浊浪东流 branch February 3, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants