当前位置: 首页>>代码示例>>Java>>正文


Java DefaultEditorKit.pasteAction方法代码示例

本文整理汇总了Java中javax.swing.text.DefaultEditorKit.pasteAction方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultEditorKit.pasteAction方法的具体用法?Java DefaultEditorKit.pasteAction怎么用?Java DefaultEditorKit.pasteAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.text.DefaultEditorKit的用法示例。


在下文中一共展示了DefaultEditorKit.pasteAction方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import javax.swing.text.DefaultEditorKit; //导入方法依赖的package包/类
/**
 * action to be performed
 *
 * @param ev
 */
public void actionPerformed(ActionEvent ev) {
    Action textPaste = null;

    DefaultEditorKit kit = new DefaultEditorKit();
    Action[] defActions = kit.getActions();
    for (Action defAction : defActions) {
        if (defAction.getValue(Action.NAME) == DefaultEditorKit.pasteAction) {
            textPaste = defAction;
            break;
        }
    }
    final Action textPasteFinal = textPaste;
    if (multiViewer.getFrame().isActive() || textPasteFinal == null) {
        execute("paste;");
    } else
        textPasteFinal.actionPerformed(ev);
}
 
开发者ID:danielhuson,项目名称:dendroscope3,代码行数:23,代码来源:PasteCommand.java

示例2: installCutCopyPasteShortcuts

import javax.swing.text.DefaultEditorKit; //导入方法依赖的package包/类
private static void installCutCopyPasteShortcuts(InputMap inputMap, boolean useSimpleActionKeys) {
  String copyActionKey = useSimpleActionKeys ? "copy" : DefaultEditorKit.copyAction;
  String pasteActionKey = useSimpleActionKeys ? "paste" : DefaultEditorKit.pasteAction;
  String cutActionKey = useSimpleActionKeys ? "cut" : DefaultEditorKit.cutAction;
  // Ctrl+Ins, Shift+Ins, Shift+Del
  inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, InputEvent.CTRL_MASK | InputEvent.CTRL_DOWN_MASK), copyActionKey);
  inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, InputEvent.SHIFT_MASK | InputEvent.SHIFT_DOWN_MASK), pasteActionKey);
  inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, InputEvent.SHIFT_MASK | InputEvent.SHIFT_DOWN_MASK), cutActionKey);
  // Ctrl+C, Ctrl+V, Ctrl+X
  inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK | InputEvent.CTRL_DOWN_MASK), copyActionKey);
  inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK | InputEvent.CTRL_DOWN_MASK), pasteActionKey);
  inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK | InputEvent.CTRL_DOWN_MASK), DefaultEditorKit.cutAction);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:LafManagerImpl.java

示例3: getActionMapKey

import javax.swing.text.DefaultEditorKit; //导入方法依赖的package包/类
public @Override Object getActionMapKey() {
    return DefaultEditorKit.pasteAction;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:PasteAction.java

示例4: PasteAction

import javax.swing.text.DefaultEditorKit; //导入方法依赖的package包/类
public PasteAction() {
	super(DefaultEditorKit.pasteAction);
}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:4,代码来源:RTextAreaEditorKit.java

示例5: getMacroID

import javax.swing.text.DefaultEditorKit; //导入方法依赖的package包/类
@Override
public final String getMacroID() {
	return DefaultEditorKit.pasteAction;
}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:5,代码来源:RTextAreaEditorKit.java

示例6: setOSXFieldShortcuts

import javax.swing.text.DefaultEditorKit; //导入方法依赖的package包/类
public static void setOSXFieldShortcuts() {
	
	String lowercaseOSName = System.getProperty("os.name").toLowerCase();
	boolean MAC_OS_X = lowercaseOSName.startsWith("mac os x");

	if(MAC_OS_X) {
		
        Object fieldInputMap = new UIDefaults.LazyInputMap(new Object[] {
        		"meta C", DefaultEditorKit.copyAction,
                "meta V", DefaultEditorKit.pasteAction,
                "meta X", DefaultEditorKit.cutAction,
                  "COPY", DefaultEditorKit.copyAction,
                 "PASTE", DefaultEditorKit.pasteAction,
                 "CUT", DefaultEditorKit.cutAction,
                 "shift LEFT", DefaultEditorKit.selectionBackwardAction,
                 "shift KP_LEFT", DefaultEditorKit.selectionBackwardAction,
                 "shift RIGHT", DefaultEditorKit.selectionForwardAction,
                 "shift KP_RIGHT", DefaultEditorKit.selectionForwardAction,
                 "alt LEFT", DefaultEditorKit.previousWordAction,
                 "alt KP_LEFT", DefaultEditorKit.previousWordAction,
                 "alt RIGHT", DefaultEditorKit.nextWordAction,
                 "alt KP_RIGHT", DefaultEditorKit.nextWordAction,
                 "alt shift LEFT", DefaultEditorKit.selectionPreviousWordAction,
                 "alt shift KP_LEFT", DefaultEditorKit.selectionPreviousWordAction,
                 "alt shift RIGHT", DefaultEditorKit.selectionNextWordAction,
                 "alt shift KP_RIGHT", DefaultEditorKit.selectionNextWordAction,
                 "meta A", DefaultEditorKit.selectAllAction,
                 "HOME", DefaultEditorKit.beginLineAction,
                 "meta LEFT", DefaultEditorKit.beginLineAction,
                 "END", DefaultEditorKit.endLineAction,
                 "meta RIGHT", DefaultEditorKit.endLineAction,
                 "shift HOME", DefaultEditorKit.selectionBeginLineAction,
                 "meta shift LEFT", DefaultEditorKit.selectionBeginLineAction,
                 "meta shift RIGHT", DefaultEditorKit.selectionEndLineAction,
                 "shift END", DefaultEditorKit.selectionEndLineAction,
                 "typed \010", DefaultEditorKit.deletePrevCharAction,
                 "DELETE", DefaultEditorKit.deleteNextCharAction,
                  //    "alt DELETE", DefaultEditorKit.deleteNextWordAction,
                  // "alt BACKSPACE", DefaultEditorKit.deletePrevWordAction,
                 "RIGHT", DefaultEditorKit.forwardAction,
                 "LEFT", DefaultEditorKit.backwardAction,
                 "UP", DefaultEditorKit.beginAction,
                 "DOWN", DefaultEditorKit.endAction,
                 "shift UP", DefaultEditorKit.selectionBeginAction,
                 "shift DOWN", DefaultEditorKit.selectionEndAction,
                 "KP_RIGHT", DefaultEditorKit.forwardAction,
                 "KP_LEFT", DefaultEditorKit.backwardAction,
                 "ENTER", JTextField.notifyAction,
                 "meta shift A", "unselect"/*DefaultEditorKit.unselectAction*/,
                 "control shift O",
                 "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
        	});

        UIManager.put("TextField.focusInputMap", fieldInputMap);
        UIManager.put("TextArea.focusInputMap", fieldInputMap);
        UIManager.put("TextPane.focusInputMap", fieldInputMap);

	}

}
 
开发者ID:andyjko,项目名称:whyline,代码行数:61,代码来源:UI.java

示例7: CEditorPasteAction

import javax.swing.text.DefaultEditorKit; //导入方法依赖的package包/类
public CEditorPasteAction()
{
	super(DefaultEditorKit.pasteAction);
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:5,代码来源:CEditorPasteAction.java

示例8: createTable

import javax.swing.text.DefaultEditorKit; //导入方法依赖的package包/类
public JTable createTable(Sheet sheet) {
    SheetTableModel sheetTableModel = new SheetTableModel(sheet);
    JTable table = new SheetTable(sheetTableModel);

    table.setDefaultRenderer(Cell.class, new CellRenderer());
    TableCellEditor editor = new org.joeffice.spreadsheet.cell.CellEditor();
    table.setDefaultEditor(Cell.class, editor);
    int columnsCount = sheetTableModel.getColumnCount();
    for (int i = 0; i < columnsCount; i++) {
        TableColumn tableColumn = table.getColumnModel().getColumn(i);
        tableColumn.setCellRenderer(new CellRenderer());
        tableColumn.setCellEditor(editor);
        int widthUnits = sheet.getColumnWidth(i);
        tableColumn.setPreferredWidth(widthUnitsToPixel(widthUnits));
    }

    int rowCount = sheetTableModel.getRowCount();
    for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
        Row row = sheet.getRow(rowIndex);
        if (row != null) {
            int cellHeight = (int) Math.ceil(sheet.getRow(rowIndex).getHeightInPoints());
            cellHeight += CELL_HEIGHT_MARGINS;
            table.setRowHeight(rowIndex, cellHeight);
        }
    }

    table.setAutoscrolls(true);
    table.setFillsViewportHeight(true);
    JLabel tableHeader = (JLabel) table.getTableHeader().getDefaultRenderer();
    tableHeader.setHorizontalAlignment(SwingConstants.CENTER);

    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    table.setCellSelectionEnabled(true);

    TableColumnAdjuster tca = new TableColumnAdjuster(table, 20);
    if (sheet.getDefaultColumnWidth() == -1) {
        table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        tca.setOnlyAdjustLarger(true);
        tca.setLeaveEmptyAsIs(true);
        tca.adjustColumns();
    }

    table.setTransferHandler(new TableTransferHandler());
    table.setDragEnabled(true);
    table.setDropMode(DropMode.ON_OR_INSERT);

    Action cutAction = new ClipboardAction(DefaultEditorKit.cutAction);
    Action copyAction = new ClipboardAction(DefaultEditorKit.copyAction);
    Action pasteAction = new ClipboardAction(DefaultEditorKit.pasteAction);
    table.getActionMap().put(DefaultEditorKit.cutAction, cutAction);
    table.getActionMap().put(DefaultEditorKit.copyAction, copyAction);
    table.getActionMap().put(DefaultEditorKit.pasteAction, pasteAction);

    //table.setIntercellSpacing(new Dimension(0, 0));
    table.putClientProperty("print.printable", Boolean.TRUE);
    Rectangle lastDataCellBounds = table.getCellRect(sheet.getLastRowNum(), sheetTableModel.getLastColumnNum(), true);
    table.putClientProperty("print.size", new Dimension(lastDataCellBounds.x + lastDataCellBounds.width, lastDataCellBounds.y + lastDataCellBounds.height));
    new SheetListener(table);

    if (!sheet.isDisplayGridlines()) {
        table.setShowGrid(false);
    }
    return table;
}
 
开发者ID:foxerfly,项目名称:Joeffice,代码行数:65,代码来源:SheetComponent.java

示例9: PasteAnnotationProxyAction

import javax.swing.text.DefaultEditorKit; //导入方法依赖的package包/类
/**
 * Creates a new proxy which calls the original paste action and then makes sure the editor
 * content is updated by calling {@link AnnotationsDecorator#updateEditorContent()}.
 *
 * @param action
 *            the original paste action which is called by this action
 */
public PasteAnnotationProxyAction(final Action action, final AnnotationsDecorator decorator) {
	super(DefaultEditorKit.pasteAction);
	this.action = action;
	this.decorator = decorator;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:13,代码来源:PasteAnnotationProxyAction.java


注:本文中的javax.swing.text.DefaultEditorKit.pasteAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。