comparison src/name/blackcap/clipman/CoerceDialog.kt @ 34:376643a09b52

Finally fixed the alignment. Wotta PITA...
author David Barts <n5jrn@me.com>
date Thu, 30 Jan 2020 19:38:59 -0800
parents 277cbb78bc5a
children 08eaae2aaf76
comparison
equal deleted inserted replaced
33:277cbb78bc5a 34:376643a09b52
2 * The dialog that controls font corecion. 2 * The dialog that controls font corecion.
3 */ 3 */
4 package name.blackcap.clipman 4 package name.blackcap.clipman
5 5
6 import java.awt.Color 6 import java.awt.Color
7 import java.awt.Container
8 import java.awt.Dimension
7 import java.awt.Font 9 import java.awt.Font
8 import java.awt.GraphicsEnvironment 10 import java.awt.GraphicsEnvironment
9 import java.awt.Toolkit 11 import java.awt.Toolkit
10 import java.awt.event.ActionEvent 12 import java.awt.event.ActionEvent
11 import java.awt.event.ActionListener 13 import java.awt.event.ActionListener
89 /* initializer */ 91 /* initializer */
90 init { 92 init {
91 title = "Coerce Fonts" 93 title = "Coerce Fonts"
92 contentPane.apply { 94 contentPane.apply {
93 add(Box(BoxLayout.Y_AXIS).apply { 95 add(Box(BoxLayout.Y_AXIS).apply {
94 alignmentX = Box.CENTER_ALIGNMENT 96 add(Box(BoxLayout.Y_AXIS).apply {
95 add(JLabel("Coerce proportionally-spaced text to…").apply {
96 horizontalAlignment = JLabel.CENTER
97 alignmentX = JLabel.CENTER_ALIGNMENT
98 border = BorderFactory.createEmptyBorder(BW2, BW2, BW, BW2) 97 border = BorderFactory.createEmptyBorder(BW2, BW2, BW, BW2)
99 }) 98 alignmentX = Box.CENTER_ALIGNMENT
100 add(Box(BoxLayout.X_AXIS).apply { 99 add(leftLabel("Coerce proportionally-spaced text to…"))
101 border = BorderFactory.createEmptyBorder(0, BW2, BW, BW2) 100 add(Box.createVerticalStrut(BW))
102 add(Box.createGlue()) 101 add(Box(BoxLayout.X_AXIS).apply {
103 add(Box(BoxLayout.Y_AXIS).apply { 102 alignmentX = Box.LEFT_ALIGNMENT
104 add(JLabel("Family:").apply { 103 add(Box.createGlue())
105 horizontalAlignment = JLabel.CENTER 104 add(Box(BoxLayout.Y_AXIS).apply {
106 alignmentX = JLabel.LEFT_ALIGNMENT 105 add(leftLabel("Family:"))
107 }) 106 add(_pFamily)
108 add(_pFamily) 107 })
108 add(Box.createGlue())
109 add(Box(BoxLayout.Y_AXIS).apply {
110 add(leftLabel("Size:"))
111 add(_pSize)
112 })
113 add(Box.createGlue())
109 }) 114 })
110 add(Box.createGlue())
111 add(Box(BoxLayout.Y_AXIS).apply {
112 add(JLabel("Size:").apply {
113 horizontalAlignment = JLabel.CENTER
114 alignmentX = JLabel.LEFT_ALIGNMENT
115 })
116 add(_pSize)
117 })
118 add(Box.createGlue())
119 }) 115 })
120 add(JSeparator()) 116 add(JSeparator())
121 add(JLabel("Coerce monospaced text to…").apply { 117 add(Box(BoxLayout.Y_AXIS).apply {
122 horizontalAlignment = JLabel.CENTER 118 alignmentX = Box.CENTER_ALIGNMENT
123 alignmentX = JLabel.CENTER_ALIGNMENT
124 border = BorderFactory.createEmptyBorder(BW, BW2, BW, BW2) 119 border = BorderFactory.createEmptyBorder(BW, BW2, BW, BW2)
125 }) 120 add(leftLabel("Coerce monospaced text to…"))
126 add(Box(BoxLayout.X_AXIS).apply { 121 add(Box.createVerticalStrut(BW))
127 border = BorderFactory.createEmptyBorder(0, BW2, BW, BW2) 122 add(Box(BoxLayout.X_AXIS).apply {
128 add(Box.createGlue()) 123 alignmentX = Box.LEFT_ALIGNMENT
129 add(Box(BoxLayout.Y_AXIS).apply { 124 add(Box.createGlue())
130 add(JLabel("Family:").apply { 125 add(Box(BoxLayout.Y_AXIS).apply {
131 horizontalAlignment = JLabel.CENTER 126 add(leftLabel("Family:"))
132 alignmentX = JLabel.LEFT_ALIGNMENT 127 add(_mFamily)
133 }) 128 })
134 add(_mFamily) 129 add(Box.createGlue())
130 add(Box(BoxLayout.Y_AXIS).apply {
131 add(leftLabel("Size:"))
132 add(_mSize)
133 })
134 add(Box.createGlue())
135 }) 135 })
136 add(Box.createGlue())
137 add(Box(BoxLayout.Y_AXIS).apply {
138 add(JLabel("Size:").apply {
139 horizontalAlignment = JLabel.CENTER
140 alignmentX = JLabel.LEFT_ALIGNMENT
141 })
142 add(_mSize)
143 })
144 add(Box.createGlue())
145 }) 136 })
146 add(JSeparator()) 137 add(JSeparator())
147 add(Box(BoxLayout.X_AXIS).apply { 138 add(Box(BoxLayout.X_AXIS).apply {
139 alignmentX = Box.CENTER_ALIGNMENT
148 border = BorderFactory.createEmptyBorder(BW, BW2, BW, BW2) 140 border = BorderFactory.createEmptyBorder(BW, BW2, BW, BW2)
149 add(Box.createGlue()) 141 add(Box.createGlue())
150 add(_cancel) 142 add(_cancel)
151 add(Box.createGlue()) 143 add(Box.createGlue())
152 add(_coerce) 144 add(_coerce)
171 setVisible(false) 163 setVisible(false)
172 coerce() 164 coerce()
173 } 165 }
174 "Cancel" -> setVisible(false) 166 "Cancel" -> setVisible(false)
175 } 167 }
168 }
169
170 private fun leftLabel(text: String) = JLabel(text).apply {
171 alignmentX = JLabel.LEFT_ALIGNMENT
176 } 172 }
177 173
178 private fun coerce() { 174 private fun coerce() {
179 val selected = queue.v.getSelected() 175 val selected = queue.v.getSelected()
180 if (selected == null) { 176 if (selected == null) {