2 * (C) Copyright IBM Corp. 1998-2004. All Rights Reserved.
\r
4 * The program is provided "as is" without any warranty express or
\r
5 * implied, including the warranty of non-infringement and the implied
\r
6 * warranties of merchantibility and fitness for a particular purpose.
\r
7 * IBM will not be liable for any damages suffered by you as a result
\r
8 * of using the Program. In no event will IBM be liable for any
\r
9 * special, indirect or consequential damages or lost profits even if
\r
10 * IBM has been advised of the possibility of their occurrence. IBM
\r
11 * will not be liable for any third party claims against you.
\r
13 package com.ibm.richtext.swingdemo;
\r
15 import java.awt.Event;
\r
17 import javax.swing.JMenu;
\r
18 import javax.swing.JMenuItem;
\r
19 import javax.swing.JSeparator;
\r
20 import javax.swing.KeyStroke;
\r
22 import com.ibm.richtext.demo.DocumentWindow;
\r
23 import com.ibm.richtext.demo.EditApplication;
\r
24 import com.ibm.richtext.demo.FileMenuManager;
\r
25 import com.ibm.richtext.demo.MenuData;
\r
26 import com.ibm.richtext.demo.ResourceUtils;
\r
28 final class SwingFileMenuManager extends FileMenuManager {
\r
30 private JMenu fMenu;
\r
32 public SwingFileMenuManager(JMenu menu,
\r
33 EditApplication application,
\r
34 DocumentWindow document,
\r
35 boolean supportStyledFormat,
\r
36 boolean supportPlainFormat) {
\r
38 super(application, document);
\r
41 createItems(supportStyledFormat, supportPlainFormat);
\r
45 protected Object addMenuItem(String key) {
\r
47 MenuData menuData = ResourceUtils.getMenuData(key);
\r
48 JMenuItem item = new JMenuItem(menuData.getName());
\r
49 if (menuData.hasShortcut()) {
\r
50 KeyStroke ks = KeyStroke.getKeyStroke(menuData.getShortcutKeyCode(),
\r
52 item.setAccelerator(ks);
\r
54 item.addActionListener(this);
\r
59 protected void addSeparator() {
\r
61 fMenu.add(new JSeparator());
\r