annotate src/name/blackcap/clipman/Menus.kt @ 60:066f05ebcc00

Fix a few more build bugs.
author David Barts <n5jrn@me.com>
date Sun, 03 Apr 2022 16:08:55 -0700
parents c6cccbe2f393
children c56a0747c256
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
1 /*
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
2 * Menu-related stuff, pertaining to both the menu bar and popup menus.
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
3 */
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
4 package name.blackcap.clipman
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
5
35
5f8475b37e23 Got it correctly enabling and disabling menu items.
David Barts <n5jrn@me.com>
parents: 31
diff changeset
6 import java.awt.Container
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
7 import java.awt.Toolkit
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
8 import java.awt.event.ActionEvent
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
9 import java.awt.event.ActionListener
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
10 import java.awt.event.KeyEvent
49
bb80148e2cb3 Log exit from File? Quit.
David Barts <n5jrn@me.com>
parents: 47
diff changeset
11 import java.util.logging.Level
bb80148e2cb3 Log exit from File? Quit.
David Barts <n5jrn@me.com>
parents: 47
diff changeset
12 import java.util.logging.Logger
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
13 import javax.swing.*
35
5f8475b37e23 Got it correctly enabling and disabling menu items.
David Barts <n5jrn@me.com>
parents: 31
diff changeset
14 import kotlin.collections.HashSet
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
15
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
16 /**
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
17 * Listen to actionEvents from both menu bar and popup menu selections.
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
18 */
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
19 class MenuItemListener: ActionListener {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
20 override fun actionPerformed(e: ActionEvent) {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
21 when (e.actionCommand) {
49
bb80148e2cb3 Log exit from File? Quit.
David Barts <n5jrn@me.com>
parents: 47
diff changeset
22 "File.Quit" -> {
bb80148e2cb3 Log exit from File? Quit.
David Barts <n5jrn@me.com>
parents: 47
diff changeset
23 LOGGER.log(Level.INFO, "execution complete")
bb80148e2cb3 Log exit from File? Quit.
David Barts <n5jrn@me.com>
parents: 47
diff changeset
24 System.exit(0)
bb80148e2cb3 Log exit from File? Quit.
David Barts <n5jrn@me.com>
parents: 47
diff changeset
25 }
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
26 "File.Preferences" -> Application.settingsDialog.setVisible(true)
30
0e88c6bed11e Remove the troublesome delete command(s).
David Barts <n5jrn@me.com>
parents: 28
diff changeset
27 "Edit.Clone" -> onlyIfSelected { PasteboardItem.write(it.contents) }
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
28 "Edit.Coerce" -> onlyIfSelected { Application.coerceDialog.setVisible(true) }
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
29 "Edit.Find" -> Application.searchDialog.setVisible(true)
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
30 "Edit.FindAgain" -> Application.searchDialog.find()
56
22725d4d7849 An attempt to get it to troff-ize styled text.
David Barts <n5jrn@me.com>
parents: 49
diff changeset
31 "Edit.Troff" -> onlyIfSelected { if (suitedForCoercing(it)) { troffize(it.contents) } }
41
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents: 39
diff changeset
32 "Help.About" -> showAboutDialog()
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
33 else -> throw RuntimeException("unexpected actionCommand!")
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
34 }
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
35 }
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
36
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
37 private fun onlyIfSelected(block: (QueueItem) -> Unit) {
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
38 val selected = Application.queue.getSelected()
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
39 if (selected == null) {
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
40 JOptionPane.showMessageDialog(Application.frame,
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
41 "No item selected.",
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
42 "Error",
31
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
43 JOptionPane.ERROR_MESSAGE)
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
44 } else {
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
45 block(selected)
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
46 }
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
47 }
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
48 }
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
49
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
50 /**
31
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
51 * Track menu items that require something to be selected in order
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
52 * to work, and allow them to be enabled and disabled en masse.
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
53 */
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
54 class SelectionRequired {
35
5f8475b37e23 Got it correctly enabling and disabling menu items.
David Barts <n5jrn@me.com>
parents: 31
diff changeset
55 private val controls = HashSet<JMenuItem>()
31
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
56
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
57 fun add(item: JMenuItem): JMenuItem {
35
5f8475b37e23 Got it correctly enabling and disabling menu items.
David Barts <n5jrn@me.com>
parents: 31
diff changeset
58 controls.add(item)
31
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
59 return item
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
60 }
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
61
35
5f8475b37e23 Got it correctly enabling and disabling menu items.
David Barts <n5jrn@me.com>
parents: 31
diff changeset
62 private fun setEnabled(state: Boolean) {
5f8475b37e23 Got it correctly enabling and disabling menu items.
David Barts <n5jrn@me.com>
parents: 31
diff changeset
63 controls.forEach {
5f8475b37e23 Got it correctly enabling and disabling menu items.
David Barts <n5jrn@me.com>
parents: 31
diff changeset
64 it.setEnabled(state)
31
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
65 }
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
66 }
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
67
35
5f8475b37e23 Got it correctly enabling and disabling menu items.
David Barts <n5jrn@me.com>
parents: 31
diff changeset
68 fun enable() = setEnabled(true)
5f8475b37e23 Got it correctly enabling and disabling menu items.
David Barts <n5jrn@me.com>
parents: 31
diff changeset
69
5f8475b37e23 Got it correctly enabling and disabling menu items.
David Barts <n5jrn@me.com>
parents: 31
diff changeset
70 fun disable() = setEnabled(false)
31
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
71 }
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
72
0c6c18a733b7 Compiles, new menu still a mess.
David Barts <n5jrn@me.com>
parents: 30
diff changeset
73 /**
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
74 * Our menu bar. What we display depends somewhat on the system type, as
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
75 * the Mac gives us a gratuitous menu bar entry for handling some stuff.
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
76 */
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
77 class MyMenuBar: JMenuBar() {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
78 init {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
79 if (OS.type != OS.MAC) {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
80 add(JMenu("File").apply {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
81 add(JMenuItem("Quit").apply {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
82 actionCommand = "File.Quit"
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
83 addActionListener(Application.menuItemListener)
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
84 makeShortcut(KeyEvent.VK_Q)
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
85 })
41
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents: 39
diff changeset
86 add(JMenuItem("Preferences…").apply {
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents: 39
diff changeset
87 actionCommand = "File.Preferences"
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
88 addActionListener(Application.menuItemListener)
41
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents: 39
diff changeset
89 makeShortcut(KeyEvent.VK_COMMA)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents: 39
diff changeset
90 })
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
91 })
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
92 }
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
93 add(JMenu("Edit").apply {
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
94 add(Application.anyRequired.add(JMenuItem("Clone").apply {
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
95 setEnabled(false)
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
96 actionCommand = "Edit.Clone"
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
97 addActionListener(Application.menuItemListener)
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
98 makeShortcut(KeyEvent.VK_C)
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
99 }))
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
100 add(Application.styledRequired.add(JMenuItem("Coerce…").apply {
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
101 setEnabled(false)
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
102 actionCommand = "Edit.Coerce"
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
103 addActionListener(Application.menuItemListener)
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
104 makeShortcut(KeyEvent.VK_K)
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
105 }))
56
22725d4d7849 An attempt to get it to troff-ize styled text.
David Barts <n5jrn@me.com>
parents: 49
diff changeset
106 add(Application.styledRequired.add(JMenuItem("Convert to Troff").apply {
22725d4d7849 An attempt to get it to troff-ize styled text.
David Barts <n5jrn@me.com>
parents: 49
diff changeset
107 setEnabled(false)
22725d4d7849 An attempt to get it to troff-ize styled text.
David Barts <n5jrn@me.com>
parents: 49
diff changeset
108 actionCommand = "Edit.Troff"
22725d4d7849 An attempt to get it to troff-ize styled text.
David Barts <n5jrn@me.com>
parents: 49
diff changeset
109 addActionListener(Application.menuItemListener)
22725d4d7849 An attempt to get it to troff-ize styled text.
David Barts <n5jrn@me.com>
parents: 49
diff changeset
110 makeShortcut(KeyEvent.VK_T)
22725d4d7849 An attempt to get it to troff-ize styled text.
David Barts <n5jrn@me.com>
parents: 49
diff changeset
111 }))
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
112 add(JMenuItem("Find…").apply {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
113 actionCommand = "Edit.Find"
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
114 addActionListener(Application.menuItemListener)
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
115 makeShortcut(KeyEvent.VK_F)
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
116 })
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
117 add(JMenuItem("Find Again").apply {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
118 actionCommand = "Edit.FindAgain"
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
119 addActionListener(Application.menuItemListener)
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
120 makeShortcut(KeyEvent.VK_G)
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
121 })
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
122 })
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
123 if (OS.type != OS.MAC) {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
124 add(JMenu("Help").apply {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
125 add(JMenuItem("About ClipMan…").apply {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
126 actionCommand = "Help.About"
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
127 addActionListener(Application.menuItemListener)
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
128 })
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
129 })
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
130 }
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
131 }
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
132
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
133 fun getMenu(name: String): JMenu? {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
134 subElements.forEach {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
135 val jmenu = it.component as? JMenu
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
136 if (jmenu?.text == name) {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
137 return jmenu
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
138 }
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
139 }
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
140 return null
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
141 }
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
142 }
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
143
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
144 /**
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
145 * The popup menu we display when the user requests so atop a clipboard
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
146 * item.
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
147 */
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
148 class MyPopupMenu: JPopupMenu() {
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
149 init {
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
150 add(Application.anyRequired.add(JMenuItem("Clone").apply {
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
151 actionCommand = "Edit.Clone"
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
152 addActionListener(Application.menuItemListener)
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
153 }))
57
c6cccbe2f393 Port to OpenJDK 15 (mostly done).
David Barts <n5jrn@me.com>
parents: 56
diff changeset
154 add(Application.styledRequired.add(JMenuItem("Convert to Troff").apply {
c6cccbe2f393 Port to OpenJDK 15 (mostly done).
David Barts <n5jrn@me.com>
parents: 56
diff changeset
155 actionCommand = "Edit.Troff"
c6cccbe2f393 Port to OpenJDK 15 (mostly done).
David Barts <n5jrn@me.com>
parents: 56
diff changeset
156 addActionListener(Application.menuItemListener)
c6cccbe2f393 Port to OpenJDK 15 (mostly done).
David Barts <n5jrn@me.com>
parents: 56
diff changeset
157 }))
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
158 add(Application.styledRequired.add(JMenuItem("Coerce…").apply {
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
159 actionCommand = "Edit.Coerce"
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
160 addActionListener(Application.menuItemListener)
27
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
161 }))
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
162 }
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
163 }
8aa2dfac27eb Big reorg; compiled but untested.
David Barts <n5jrn@me.com>
parents:
diff changeset
164
41
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents: 39
diff changeset
165 /**
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents: 39
diff changeset
166 * Show an About dialog.
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents: 39
diff changeset
167 */
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents: 39
diff changeset
168 fun showAboutDialog() {
47
19d9da731c43 Recoded; cleaned up root namespace, removed race conditions.
David Barts <n5jrn@me.com>
parents: 41
diff changeset
169 JOptionPane.showMessageDialog(Application.frame,
41
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents: 39
diff changeset
170 "ClipMan, a clipboard manager.\n"
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents: 39
diff changeset
171 + "© MMXX, David W. Barts",
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents: 39
diff changeset
172 "About ClipMan",
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents: 39
diff changeset
173 JOptionPane.PLAIN_MESSAGE)
33fbe3a78d84 Got the settings stuff compiling (untested).
David Barts <n5jrn@me.com>
parents: 39
diff changeset
174 }