added mnemonics to menu items
uncommented the key shortcuts code
This commit is contained in:
parent
7d1529ef4b
commit
8eef5a6182
1 changed files with 28 additions and 2 deletions
|
@ -295,10 +295,12 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
fileChooser.addChoosableFileFilter(rtfFilter);
|
fileChooser.addChoosableFileFilter(rtfFilter);
|
||||||
|
|
||||||
fileMenu = new JMenu("File");
|
fileMenu = new JMenu("File");
|
||||||
|
fileMenu.setMnemonic ( 'F' ) ;
|
||||||
numItemsOnFileMenuBeforeRecentlyOpened = 0;
|
numItemsOnFileMenuBeforeRecentlyOpened = 0;
|
||||||
|
|
||||||
|
|
||||||
JMenuItem newItem = new JMenuItem("New...");
|
JMenuItem newItem = new JMenuItem("New...");
|
||||||
|
newItem.setMnemonic ( 'N' ) ;
|
||||||
// newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,java.awt.Event.CTRL_MASK)); //Ctrl-n
|
// newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,java.awt.Event.CTRL_MASK)); //Ctrl-n
|
||||||
newItem.addActionListener(new ThdlActionListener() {
|
newItem.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
|
@ -309,7 +311,8 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
fileMenu.add(newItem);
|
fileMenu.add(newItem);
|
||||||
|
|
||||||
JMenuItem openItem = new JMenuItem("Open...");
|
JMenuItem openItem = new JMenuItem("Open...");
|
||||||
// openItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,java.awt.Event.CTRL_MASK)); //Ctrl-o
|
openItem.setMnemonic ( 'o' ) ;
|
||||||
|
openItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O,java.awt.Event.CTRL_MASK)); //Ctrl-o
|
||||||
openItem.addActionListener(new ThdlActionListener() {
|
openItem.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
openFile();
|
openFile();
|
||||||
|
@ -320,6 +323,7 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
|
|
||||||
if (parentObject instanceof JFrame) {
|
if (parentObject instanceof JFrame) {
|
||||||
JMenuItem closeItem = new JMenuItem("Close");
|
JMenuItem closeItem = new JMenuItem("Close");
|
||||||
|
closeItem.setMnemonic ( 'c' ) ;
|
||||||
closeItem.addActionListener(new ThdlActionListener() {
|
closeItem.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
if (numberOfTibsRTFOpen == 1) {
|
if (numberOfTibsRTFOpen == 1) {
|
||||||
|
@ -338,7 +342,8 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
fileMenu.add(closeItem);
|
fileMenu.add(closeItem);
|
||||||
}
|
}
|
||||||
JMenuItem saveItem = new JMenuItem("Save");
|
JMenuItem saveItem = new JMenuItem("Save");
|
||||||
// saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,java.awt.Event.CTRL_MASK)); //Ctrl-s
|
saveItem.setMnemonic ( 's' ) ;
|
||||||
|
saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,java.awt.Event.CTRL_MASK)); //Ctrl-s
|
||||||
saveItem.addActionListener(new ThdlActionListener() {
|
saveItem.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
if (fileName == null)
|
if (fileName == null)
|
||||||
|
@ -354,6 +359,7 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
fileMenu.add(saveItem);
|
fileMenu.add(saveItem);
|
||||||
|
|
||||||
JMenuItem saveAsItem = new JMenuItem("Save as...");
|
JMenuItem saveAsItem = new JMenuItem("Save as...");
|
||||||
|
saveAsItem.setMnemonic ( 'a' ) ;
|
||||||
saveAsItem.addActionListener(new ThdlActionListener() {
|
saveAsItem.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
saveAsFile("legacy rtf");
|
saveAsFile("legacy rtf");
|
||||||
|
@ -382,6 +388,7 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
|
|
||||||
if (parentObject instanceof JFrame) {
|
if (parentObject instanceof JFrame) {
|
||||||
JMenuItem exitItem = new JMenuItem("Exit");
|
JMenuItem exitItem = new JMenuItem("Exit");
|
||||||
|
exitItem.setMnemonic ( 'x' ) ;
|
||||||
exitItem.addActionListener(new ThdlActionListener() {
|
exitItem.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
exitAction();
|
exitAction();
|
||||||
|
@ -397,9 +404,11 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
JMenu editMenu = new JMenu("Edit");
|
JMenu editMenu = new JMenu("Edit");
|
||||||
|
editMenu.setMnemonic ( 'E' ) ;
|
||||||
|
|
||||||
if (parentObject instanceof JFrame || parentObject instanceof JInternalFrame) {
|
if (parentObject instanceof JFrame || parentObject instanceof JInternalFrame) {
|
||||||
JMenuItem cutItem = new JMenuItem("Cut");
|
JMenuItem cutItem = new JMenuItem("Cut");
|
||||||
|
cutItem.setMnemonic ( 'u' ) ;
|
||||||
cutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,
|
cutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X,
|
||||||
java.awt.Event.CTRL_MASK)); //Ctrl-x
|
java.awt.Event.CTRL_MASK)); //Ctrl-x
|
||||||
cutItem.addActionListener(new ThdlActionListener() {
|
cutItem.addActionListener(new ThdlActionListener() {
|
||||||
|
@ -410,6 +419,7 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
editMenu.add(cutItem);
|
editMenu.add(cutItem);
|
||||||
|
|
||||||
JMenuItem copyItem = new JMenuItem("Copy");
|
JMenuItem copyItem = new JMenuItem("Copy");
|
||||||
|
copyItem.setMnemonic ( 'C' ) ;
|
||||||
copyItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,
|
copyItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,
|
||||||
java.awt.Event.CTRL_MASK)); //Ctrl-c
|
java.awt.Event.CTRL_MASK)); //Ctrl-c
|
||||||
copyItem.addActionListener(new ThdlActionListener() {
|
copyItem.addActionListener(new ThdlActionListener() {
|
||||||
|
@ -420,6 +430,7 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
editMenu.add(copyItem);
|
editMenu.add(copyItem);
|
||||||
|
|
||||||
JMenuItem copyAsUnicodeItem = new JMenuItem("Copy as Unicode");
|
JMenuItem copyAsUnicodeItem = new JMenuItem("Copy as Unicode");
|
||||||
|
copyAsUnicodeItem.setMnemonic ( 'i' ) ;
|
||||||
copyAsUnicodeItem.addActionListener(new ThdlActionListener() {
|
copyAsUnicodeItem.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
copyAsUnicodeSelection();
|
copyAsUnicodeSelection();
|
||||||
|
@ -428,6 +439,7 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
editMenu.add(copyAsUnicodeItem);
|
editMenu.add(copyAsUnicodeItem);
|
||||||
|
|
||||||
JMenuItem pasteItem = new JMenuItem("Paste");
|
JMenuItem pasteItem = new JMenuItem("Paste");
|
||||||
|
pasteItem.setMnemonic ( 'P' ) ;
|
||||||
pasteItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,
|
pasteItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,
|
||||||
java.awt.Event.CTRL_MASK)); //Ctrl-v
|
java.awt.Event.CTRL_MASK)); //Ctrl-v
|
||||||
pasteItem.addActionListener(new ThdlActionListener() {
|
pasteItem.addActionListener(new ThdlActionListener() {
|
||||||
|
@ -439,6 +451,7 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
editMenu.addSeparator();
|
editMenu.addSeparator();
|
||||||
|
|
||||||
JMenuItem selectallItem = new JMenuItem("Select All");
|
JMenuItem selectallItem = new JMenuItem("Select All");
|
||||||
|
selectallItem.setMnemonic ( 'A' ) ;
|
||||||
selectallItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A,
|
selectallItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A,
|
||||||
java.awt.Event.CTRL_MASK)); //Ctrl-a
|
java.awt.Event.CTRL_MASK)); //Ctrl-a
|
||||||
selectallItem.addActionListener(new ThdlActionListener() {
|
selectallItem.addActionListener(new ThdlActionListener() {
|
||||||
|
@ -452,6 +465,9 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
|
|
||||||
{
|
{
|
||||||
JMenuItem preferencesItem = new JMenuItem("Preferences");
|
JMenuItem preferencesItem = new JMenuItem("Preferences");
|
||||||
|
preferencesItem.setMnemonic ( 'P' ) ;
|
||||||
|
preferencesItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E,
|
||||||
|
java.awt.Event.CTRL_MASK)); //Ctrl-e
|
||||||
preferencesItem.addActionListener(new ThdlActionListener() {
|
preferencesItem.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
setPreferences();
|
setPreferences();
|
||||||
|
@ -463,6 +479,7 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
|
|
||||||
{
|
{
|
||||||
JMenuItem preferencesItem = new JMenuItem("Save preferences to " + ThdlOptions.getUserPreferencesPath());
|
JMenuItem preferencesItem = new JMenuItem("Save preferences to " + ThdlOptions.getUserPreferencesPath());
|
||||||
|
preferencesItem.setMnemonic ( 'S' ) ;
|
||||||
preferencesItem.addActionListener(new ThdlActionListener() {
|
preferencesItem.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
savePreferencesAction();
|
savePreferencesAction();
|
||||||
|
@ -473,6 +490,7 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
|
|
||||||
{
|
{
|
||||||
JMenuItem preferencesItem = new JMenuItem("Clear preferences");
|
JMenuItem preferencesItem = new JMenuItem("Clear preferences");
|
||||||
|
preferencesItem.setMnemonic ( 'C' ) ;
|
||||||
preferencesItem.addActionListener(new ThdlActionListener() {
|
preferencesItem.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
clearPreferencesAction();
|
clearPreferencesAction();
|
||||||
|
@ -485,9 +503,12 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
menuBar.add(editMenu);
|
menuBar.add(editMenu);
|
||||||
|
|
||||||
JMenu toolsMenu = new JMenu("Tools");
|
JMenu toolsMenu = new JMenu("Tools");
|
||||||
|
toolsMenu.setMnemonic ( 'T' ) ;
|
||||||
|
|
||||||
JMenu convertSelectionMenu = new JMenu("Convert Selection");
|
JMenu convertSelectionMenu = new JMenu("Convert Selection");
|
||||||
|
convertSelectionMenu.setMnemonic ( 'o' ) ;
|
||||||
JMenuItem TMWWylieItem = new JMenuItem("Convert Tibetan Machine Web (non-Unicode) to Wylie");
|
JMenuItem TMWWylieItem = new JMenuItem("Convert Tibetan Machine Web (non-Unicode) to Wylie");
|
||||||
|
TMWWylieItem.setMnemonic ( 'T' ) ;
|
||||||
TMWWylieItem.addActionListener(new ThdlActionListener() {
|
TMWWylieItem.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
toTranslit(true);
|
toTranslit(true);
|
||||||
|
@ -497,6 +518,7 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
toolsMenu.add(convertSelectionMenu);
|
toolsMenu.add(convertSelectionMenu);
|
||||||
|
|
||||||
JMenuItem TMWACIPItem = new JMenuItem("Convert Tibetan Machine Web (non-Unicode) to ACIP");
|
JMenuItem TMWACIPItem = new JMenuItem("Convert Tibetan Machine Web (non-Unicode) to ACIP");
|
||||||
|
TMWACIPItem.setMnemonic ( 'W' ) ;
|
||||||
TMWACIPItem.addActionListener(new ThdlActionListener() {
|
TMWACIPItem.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
toTranslit(false);
|
toTranslit(false);
|
||||||
|
@ -505,6 +527,7 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
convertSelectionMenu.add(TMWACIPItem);
|
convertSelectionMenu.add(TMWACIPItem);
|
||||||
|
|
||||||
JMenuItem wylieTMWItem = new JMenuItem("Convert Wylie to Tibetan Machine Web (non-Unicode) (no warnings)");
|
JMenuItem wylieTMWItem = new JMenuItem("Convert Wylie to Tibetan Machine Web (non-Unicode) (no warnings)");
|
||||||
|
wylieTMWItem.setMnemonic ( 'M' ) ;
|
||||||
wylieTMWItem.addActionListener(new ThdlActionListener() {
|
wylieTMWItem.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
toTibetan(false, false);
|
toTibetan(false, false);
|
||||||
|
@ -709,6 +732,7 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
menuBar.add(toolsMenu);
|
menuBar.add(toolsMenu);
|
||||||
|
|
||||||
JMenu helpMenu = new JMenu("Help");
|
JMenu helpMenu = new JMenu("Help");
|
||||||
|
helpMenu.setMnemonic ( 'H' ) ;
|
||||||
|
|
||||||
{
|
{
|
||||||
JMenuItem helpItem = new JMenuItem("Help...");
|
JMenuItem helpItem = new JMenuItem("Help...");
|
||||||
|
@ -732,6 +756,7 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
|
|
||||||
{
|
{
|
||||||
JMenuItem helpItem = new JMenuItem("Jskad on the Web...");
|
JMenuItem helpItem = new JMenuItem("Jskad on the Web...");
|
||||||
|
helpItem.setMnemonic ( 'J' ) ;
|
||||||
helpItem.addActionListener(new ThdlActionListener() {
|
helpItem.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
CalHTMLPane onlineHelpPane = new CalHTMLPane();
|
CalHTMLPane onlineHelpPane = new CalHTMLPane();
|
||||||
|
@ -772,6 +797,7 @@ public class Jskad extends JPanel implements DocumentListener {
|
||||||
|
|
||||||
{
|
{
|
||||||
JMenuItem aboutItem = new JMenuItem("About...");
|
JMenuItem aboutItem = new JMenuItem("About...");
|
||||||
|
aboutItem.setMnemonic ( 'A' ) ;
|
||||||
aboutItem.addActionListener(new ThdlActionListener() {
|
aboutItem.addActionListener(new ThdlActionListener() {
|
||||||
public void theRealActionPerformed(ActionEvent e) {
|
public void theRealActionPerformed(ActionEvent e) {
|
||||||
JOptionPane.showMessageDialog(Jskad.this,
|
JOptionPane.showMessageDialog(Jskad.this,
|
||||||
|
|
Loading…
Reference in a new issue