コード例 #1
0
ファイル: MenuHandler.java プロジェクト: OrfeasZ/AweSheet
  private void initFileMenu() {
    fileMenu = new JMenu("   File   ");

    fileNewItem = new JMenuItem(new NewWorkbookAction());
    fileNewItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK));
    fileNewItem.setPreferredSize(new Dimension(200, 26));

    fileOpenItem = new JMenuItem(new OpenWorkbookAction());
    fileOpenItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK));
    fileOpenItem.setPreferredSize(new Dimension(200, 26));

    fileSaveItem = new JMenuItem(new SaveWorkbookAction());
    fileSaveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));
    fileSaveItem.setEnabled(false);
    fileSaveItem.setPreferredSize(new Dimension(200, 26));

    fileSaveAsItem = new JMenuItem(new SaveWorkbookAsAction());
    fileSaveAsItem.setAccelerator(
        KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK));
    fileSaveAsItem.setEnabled(false);
    fileSaveAsItem.setPreferredSize(new Dimension(200, 26));

    fileImportItem = new JMenuItem(new ImportCSVAction());
    fileImportItem.setPreferredSize(new Dimension(200, 26));
    fileImportItem.setEnabled(false);

    fileExportItem = new JMenuItem(new ExportCSVAction());
    fileExportItem.setPreferredSize(new Dimension(200, 26));
    fileExportItem.setEnabled(false);

    fileExitItem = new JMenuItem(new ExitApplicationAction());
    fileExitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_MASK));
    fileExitItem.setPreferredSize(new Dimension(200, 26));

    fileMenu.add(fileNewItem);
    fileMenu.add(fileOpenItem);
    fileMenu.add(fileSaveItem);
    fileMenu.add(fileSaveAsItem);
    fileMenu.add(new JSeparator());
    fileMenu.add(fileImportItem);
    fileMenu.add(fileExportItem);
    fileMenu.add(new JSeparator());
    fileMenu.add(fileExitItem);
  }
コード例 #2
0
ファイル: MenuHandler.java プロジェクト: OrfeasZ/AweSheet
  private void initViewMenu() {
    viewMenu = new JMenu("   View   ");

    viewMaximizeItem = new JMenuItem(new MaximizeWindowAction());
    viewMaximizeItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0));
    viewMaximizeItem.setPreferredSize(new Dimension(200, 26));

    viewMinimizeItem = new JMenuItem(new MinimizeWindowAction());
    viewMinimizeItem.setPreferredSize(new Dimension(200, 26));

    viewMenu.add(viewMaximizeItem);
    viewMenu.add(viewMinimizeItem);
  }
コード例 #3
0
ファイル: MenuHandler.java プロジェクト: OrfeasZ/AweSheet
  private void initEditMenu() {
    editMenu = new JMenu("   Edit   ");

    editCopyItem = new JMenuItem(new CopyCellAction());
    editCopyItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK));
    editCopyItem.setPreferredSize(new Dimension(200, 26));
    editCopyItem.setEnabled(false);

    editCutItem = new JMenuItem(new CutCellAction());
    editCutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK));
    editCutItem.setPreferredSize(new Dimension(200, 26));
    editCutItem.setEnabled(false);

    editPasteItem = new JMenuItem(new PasteCellAction());
    editPasteItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK));
    editPasteItem.setPreferredSize(new Dimension(200, 26));
    editPasteItem.setEnabled(false);

    editMenu.add(editCopyItem);
    editMenu.add(editCutItem);
    editMenu.add(editPasteItem);
  }
コード例 #4
0
ファイル: MenuHandler.java プロジェクト: OrfeasZ/AweSheet
  private void initHelpMenu() {
    helpMenu = new JMenu("   Help   ");

    helpDocumentationItem = new JMenuItem(new ViewDocumentationAction());
    helpDocumentationItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0));
    helpDocumentationItem.setPreferredSize(new Dimension(200, 26));

    helpOnlineDocumentationItem = new JMenuItem(new ViewOnlineDocumentationAction());
    helpOnlineDocumentationItem.setPreferredSize(new Dimension(200, 26));

    helpAboutItem = new JMenuItem(new ViewAboutAction());
    helpAboutItem.setPreferredSize(new Dimension(200, 26));

    helpMenu.add(helpDocumentationItem);
    helpMenu.add(helpOnlineDocumentationItem);
    helpMenu.add(new JSeparator());
    helpMenu.add(helpAboutItem);
  }