Mercurial > cgi-bin > hgweb.cgi > ClipMan
diff src/name/blackcap/clipman/Menus.kt @ 41:33fbe3a78d84
Got the settings stuff compiling (untested).
author | David Barts <n5jrn@me.com> |
---|---|
date | Sat, 08 Feb 2020 22:10:01 -0700 |
parents | 2a5808156f99 |
children | 19d9da731c43 |
line wrap: on
line diff
--- a/src/name/blackcap/clipman/Menus.kt Wed Feb 05 16:47:25 2020 -0800 +++ b/src/name/blackcap/clipman/Menus.kt Sat Feb 08 22:10:01 2020 -0700 @@ -18,15 +18,12 @@ override fun actionPerformed(e: ActionEvent) { when (e.actionCommand) { "File.Quit" -> System.exit(0) + "File.Preferences" -> settingsDialog.setVisible(true) "Edit.Clone" -> onlyIfSelected { PasteboardItem.write(it.contents) } "Edit.Coerce" -> onlyIfSelected { coerceDialog.setVisible(true) } "Edit.Find" -> searchDialog.setVisible(true) "Edit.FindAgain" -> searchDialog.find() - "Help.About" -> JOptionPane.showMessageDialog(frame.v, - "ClipMan, a clipboard manager.\n" - + "© MMXX, David W. Barts", - "About ClipMan", - JOptionPane.PLAIN_MESSAGE) + "Help.About" -> showAboutDialog() else -> throw RuntimeException("unexpected actionCommand!") } } @@ -85,6 +82,11 @@ addActionListener(menuItemListener) makeShortcut(KeyEvent.VK_Q) }) + add(JMenuItem("Preferences…").apply { + actionCommand = "File.Preferences" + addActionListener(menuItemListener) + makeShortcut(KeyEvent.VK_COMMA) + }) }) } add(JMenu("Edit").apply { @@ -152,3 +154,14 @@ } val popupMenu = MyPopupMenu() + +/** + * Show an About dialog. + */ +fun showAboutDialog() { + JOptionPane.showMessageDialog(frame.v, + "ClipMan, a clipboard manager.\n" + + "© MMXX, David W. Barts", + "About ClipMan", + JOptionPane.PLAIN_MESSAGE) +}