當前位置: 首頁>>代碼示例>>Java>>正文


Java TransferHandler.NONE屬性代碼示例

本文整理匯總了Java中javax.swing.TransferHandler.NONE屬性的典型用法代碼示例。如果您正苦於以下問題:Java TransferHandler.NONE屬性的具體用法?Java TransferHandler.NONE怎麽用?Java TransferHandler.NONE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.swing.TransferHandler的用法示例。


在下文中一共展示了TransferHandler.NONE屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mapDragOperationFromModifiers

protected int mapDragOperationFromModifiers(MouseEvent e) {
    int mods = e.getModifiersEx();
    
    if ((mods & InputEvent.BUTTON1_DOWN_MASK) == 0) {
        return TransferHandler.NONE;
    }
    
    return TransferHandler.COPY_OR_MOVE;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:BaseCaret.java

示例2: mapDragOperationFromModifiers

private int mapDragOperationFromModifiers(MouseEvent e) {
    int mods = e.getModifiersEx();
    
    if ((mods & InputEvent.BUTTON1_DOWN_MASK) == 0) {
        return TransferHandler.NONE;
    }
    
    return TransferHandler.COPY_OR_MOVE;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:EditorCaret.java

示例3: mousePressed

@Override
public void mousePressed(MouseEvent evt) {
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("mousePressed: " + logMouseEvent(evt) + ", state=" + mouseState + '\n'); // NOI18N
    }

    JTextComponent c = component;
    if (c != null && isLeftMouseButtonExt(evt)) {
        // Expand fold if offset is in collapsed fold
        int offset = mouse2Offset(evt);
        switch (evt.getClickCount()) {
            case 1: // Single press
                if (c.isEnabled() && !c.hasFocus()) {
                    c.requestFocus();
                }
                c.setDragEnabled(true);
                if (evt.isShiftDown()) { // Select till offset
                    moveDot(offset);
                    adjustRectangularSelectionMouseX(evt.getX(), evt.getY()); // also fires state change
                    mouseState = MouseState.CHAR_SELECTION;
                } else { // Regular press
                    // check whether selection drag is possible
                    if (isDragPossible(evt) && mapDragOperationFromModifiers(evt) != TransferHandler.NONE) {
                        mouseState = MouseState.DRAG_SELECTION_POSSIBLE;
                    } else { // Drag not possible
                        mouseState = MouseState.CHAR_SELECTION;
                        setDot(offset);
                    }
                }
                break;

            case 2: // double-click => word selection
                mouseState = MouseState.WORD_SELECTION;
                // Disable drag which would otherwise occur when mouse would be over text
                c.setDragEnabled(false);
                // Check possible fold expansion
                try {
                    // hack, to get knowledge of possible expansion. Editor depends on Folding, so it's not really possible
                    // to have Folding depend on BaseCaret (= a cycle). If BaseCaret moves to editor.lib2, this contract
                    // can be formalized as an interface.
                    Callable<Boolean> cc = (Callable<Boolean>)c.getClientProperty("org.netbeans.api.fold.expander");
                    if (cc == null || !cc.equals(this)) {
                        if (selectWordAction == null) {
                            selectWordAction = ((BaseKit) c.getUI().getEditorKit(
                                    c)).getActionByName(BaseKit.selectWordAction);
                        }
                        if (selectWordAction != null) {
                            selectWordAction.actionPerformed(null);
                        }
                        // Select word action selects forward i.e. dot > mark
                        minSelectionStartOffset = getMark();
                        minSelectionEndOffset = getDot();
                    }
                } catch (Exception ex) {
                    Exceptions.printStackTrace(ex);
                }
                break;
                
            case 3: // triple-click => line selection
                mouseState = MouseState.LINE_SELECTION;
                // Disable drag which would otherwise occur when mouse would be over text
                c.setDragEnabled(false);
                if (selectLineAction == null) {
                    selectLineAction = ((BaseKit) c.getUI().getEditorKit(
                            c)).getActionByName(BaseKit.selectLineAction);
                }
                if (selectLineAction != null) {
                    selectLineAction.actionPerformed(null);
                    // Select word action selects forward i.e. dot > mark
                    minSelectionStartOffset = getMark();
                    minSelectionEndOffset = getDot();
                }
                break;

            default: // multi-click
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:78,代碼來源:BaseCaret.java

示例4: getSourceActions

@Override final public int getSourceActions(JComponent objPjComponent) {
	return this.objGtextTransferHandler != null ? this.objGtextTransferHandler.getSourceActions(objPjComponent) : TransferHandler.NONE;
}
 
開發者ID:jugglemaster,項目名稱:JuggleMasterPro,代碼行數:3,代碼來源:ExtendedTransferHandler.java

示例5: exportDone

@Override
protected void exportDone(JComponent c, Transferable t, int act) {
   if ((act == TransferHandler.MOVE) || (act == TransferHandler.NONE)) {
      table.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
   }
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:6,代碼來源:Digitizer.java


注:本文中的javax.swing.TransferHandler.NONE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。