mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-20 17:52:23 +00:00
fix: adjust tag panel layout to use GridBagLayout for proper vertical alignment (relates #857)
This commit is contained in:
parent
926ef3f90c
commit
0c4340bbd6
2 changed files with 17 additions and 6 deletions
|
|
@ -53,8 +53,9 @@ class UserInputHeaderPanel(
|
|||
private val emptyText = JBLabel("No context included").apply {
|
||||
foreground = JBUI.CurrentTheme.Label.disabledForeground()
|
||||
font = JBUI.Fonts.smallFont()
|
||||
border = JBUI.Borders.empty(3, 4)
|
||||
isVisible = getSelectedEditor(project) == null
|
||||
preferredSize = Dimension(preferredSize.width, 20)
|
||||
verticalAlignment = JBLabel.CENTER
|
||||
}
|
||||
private val selectionTagPanel = SelectionTagPanel(project, promptTextField)
|
||||
private val defaultHeaderTagsPanel = CustomFlowPanel().apply {
|
||||
|
|
|
|||
|
|
@ -17,11 +17,13 @@ import ee.carlrobert.codegpt.util.EditorUtil.getSelectedEditor
|
|||
import ee.carlrobert.codegpt.util.EditorUtil.getSelectedEditorFile
|
||||
import java.awt.Cursor
|
||||
import java.awt.Dimension
|
||||
import java.awt.FlowLayout
|
||||
import java.awt.GridBagConstraints
|
||||
import java.awt.GridBagLayout
|
||||
import java.awt.Graphics
|
||||
import javax.swing.Icon
|
||||
import javax.swing.JButton
|
||||
import javax.swing.JToggleButton
|
||||
import javax.swing.JPanel
|
||||
|
||||
abstract class TagPanel(
|
||||
var tagDetails: TagDetails,
|
||||
|
|
@ -67,14 +69,22 @@ abstract class TagPanel(
|
|||
|
||||
private fun setupUI() {
|
||||
isOpaque = false
|
||||
layout = FlowLayout(FlowLayout.LEFT, 0, 0)
|
||||
border = JBUI.Borders.empty(2, 8)
|
||||
layout = GridBagLayout()
|
||||
border = JBUI.Borders.empty(2, 6)
|
||||
cursor = Cursor(Cursor.HAND_CURSOR)
|
||||
isSelected = tagDetails.selected
|
||||
closeButton.isVisible = isSelected
|
||||
|
||||
add(label)
|
||||
add(closeButton)
|
||||
val gbc = GridBagConstraints().apply {
|
||||
gridx = 0
|
||||
gridy = 0
|
||||
anchor = GridBagConstraints.CENTER
|
||||
fill = GridBagConstraints.NONE
|
||||
}
|
||||
|
||||
add(label, gbc)
|
||||
gbc.gridx = 1
|
||||
add(closeButton, gbc)
|
||||
|
||||
addActionListener {
|
||||
if (isRevertingSelection) return@addActionListener
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue