feat: 弹窗位置以父窗口为中心 (#55)

This commit is contained in:
hstyi
2025-01-10 15:08:01 +08:00
committed by GitHub
parent 68df52bfc0
commit 923afb7e99

View File

@@ -68,6 +68,7 @@ class TermoraFrame : JFrame() {
FlatDesktop.setPreferencesHandler(that) FlatDesktop.setPreferencesHandler(that)
} }
}) })
dialog.setLocationRelativeTo(owner)
dialog.isVisible = true dialog.isVisible = true
} }
} }
@@ -222,7 +223,9 @@ class TermoraFrame : JFrame() {
val focusWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().focusedWindow val focusWindow = KeyboardFocusManager.getCurrentKeyboardFocusManager().focusedWindow
val frame = this@TermoraFrame val frame = this@TermoraFrame
if (focusWindow == frame) { if (focusWindow == frame) {
FindEverywhere(frame).isVisible = true val dialog = FindEverywhere(frame)
dialog.setLocationRelativeTo(frame)
dialog.isVisible = true
} }
} }
} }