mirror of
https://github.com/TermoraDev/termora.git
synced 2026-01-16 02:12:58 +08:00
chore: improve dialog
This commit is contained in:
@@ -51,6 +51,7 @@ class ChooseColorTemplateDialog(owner: Window, title: String) : DialogWrapper(ow
|
|||||||
val customBtn = JButton("Custom")
|
val customBtn = JButton("Custom")
|
||||||
customBtn.addActionListener {
|
customBtn.addActionListener {
|
||||||
val dialog = MyColorPickerDialog(this)
|
val dialog = MyColorPickerDialog(this)
|
||||||
|
dialog.setLocationRelativeTo(this)
|
||||||
dialog.colorPicker.color = defaultColor
|
dialog.colorPicker.color = defaultColor
|
||||||
dialog.isVisible = true
|
dialog.isVisible = true
|
||||||
val color = dialog.color
|
val color = dialog.color
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ class NewKeywordHighlightDialog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createColorPanel(color: Color, title: String): ColorPanel {
|
private fun createColorPanel(color: Color, title: String): ColorPanel {
|
||||||
|
val owner = this
|
||||||
val arc = UIManager.getInt("Component.arc")
|
val arc = UIManager.getInt("Component.arc")
|
||||||
val lineBorder = FlatLineBorder(Insets(1, 1, 1, 1), DynamicColor.BorderColor, 1f, arc)
|
val lineBorder = FlatLineBorder(Insets(1, 1, 1, 1), DynamicColor.BorderColor, 1f, arc)
|
||||||
val colorPanel = ColorPanel(color)
|
val colorPanel = ColorPanel(color)
|
||||||
@@ -193,7 +194,8 @@ class NewKeywordHighlightDialog(
|
|||||||
colorPanel.addMouseListener(object : MouseAdapter() {
|
colorPanel.addMouseListener(object : MouseAdapter() {
|
||||||
override fun mouseClicked(e: MouseEvent) {
|
override fun mouseClicked(e: MouseEvent) {
|
||||||
if (SwingUtilities.isLeftMouseButton(e)) {
|
if (SwingUtilities.isLeftMouseButton(e)) {
|
||||||
val dialog = ChooseColorTemplateDialog(this@NewKeywordHighlightDialog, title)
|
val dialog = ChooseColorTemplateDialog(owner, title)
|
||||||
|
dialog.setLocationRelativeTo(owner)
|
||||||
dialog.defaultColor = colorPanel.color
|
dialog.defaultColor = colorPanel.color
|
||||||
dialog.isVisible = true
|
dialog.isVisible = true
|
||||||
colorPanel.color = dialog.color ?: return
|
colorPanel.color = dialog.color ?: return
|
||||||
|
|||||||
@@ -2,10 +2,12 @@ package app.termora.terminal.panel.vw
|
|||||||
|
|
||||||
import app.termora.*
|
import app.termora.*
|
||||||
import com.formdev.flatlaf.extras.components.FlatToolBar
|
import com.formdev.flatlaf.extras.components.FlatToolBar
|
||||||
|
import com.formdev.flatlaf.util.SystemInfo
|
||||||
import java.awt.*
|
import java.awt.*
|
||||||
import java.awt.event.*
|
import java.awt.event.*
|
||||||
import java.beans.PropertyChangeEvent
|
import java.beans.PropertyChangeEvent
|
||||||
import java.beans.PropertyChangeListener
|
import java.beans.PropertyChangeListener
|
||||||
|
import javax.imageio.ImageIO
|
||||||
import javax.swing.*
|
import javax.swing.*
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
@@ -333,6 +335,15 @@ open class VisualWindowPanel(protected val id: String, protected val visualWindo
|
|||||||
title = getWindowTitle()
|
title = getWindowTitle()
|
||||||
isAlwaysOnTop = isAlwaysTop
|
isAlwaysOnTop = isAlwaysTop
|
||||||
|
|
||||||
|
if (SystemInfo.isWindows || SystemInfo.isLinux) {
|
||||||
|
val sizes = listOf(16, 20, 24, 28, 32, 48, 64)
|
||||||
|
val loader = TermoraFrame::class.java.classLoader
|
||||||
|
val images = sizes.mapNotNull { e ->
|
||||||
|
loader.getResourceAsStream("icons/termora_${e}x${e}.png")?.use { ImageIO.read(it) }
|
||||||
|
}
|
||||||
|
iconImages = images
|
||||||
|
}
|
||||||
|
|
||||||
initEvents()
|
initEvents()
|
||||||
|
|
||||||
init()
|
init()
|
||||||
|
|||||||
Reference in New Issue
Block a user