Example usage for javax.swing.text DefaultEditorKit.CutAction DefaultEditorKit.CutAction

List of usage examples for javax.swing.text DefaultEditorKit.CutAction DefaultEditorKit.CutAction

Introduction

In this page you can find the example usage for javax.swing.text DefaultEditorKit.CutAction DefaultEditorKit.CutAction.

Prototype

DefaultEditorKit.CutAction

Source Link

Usage

From source file:dnd.TextCutPaste.java

/**
 * Create an Edit menu to support cut/copy/paste.
 *///  ww  w . j a  va  2 s. c  o m
public JMenuBar createMenuBar() {
    JMenuItem menuItem = null;
    JMenuBar menuBar = new JMenuBar();
    JMenu mainMenu = new JMenu("Edit");
    mainMenu.setMnemonic(KeyEvent.VK_E);

    menuItem = new JMenuItem(new DefaultEditorKit.CutAction());
    menuItem.setText("Cut");
    menuItem.setMnemonic(KeyEvent.VK_T);
    mainMenu.add(menuItem);

    menuItem = new JMenuItem(new DefaultEditorKit.CopyAction());
    menuItem.setText("Copy");
    menuItem.setMnemonic(KeyEvent.VK_C);
    mainMenu.add(menuItem);

    menuItem = new JMenuItem(new DefaultEditorKit.PasteAction());
    menuItem.setText("Paste");
    menuItem.setMnemonic(KeyEvent.VK_P);
    mainMenu.add(menuItem);

    menuBar.add(mainMenu);
    return menuBar;
}