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


Java KeyEvent.isControlDown方法代码示例

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


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

示例1: keyTyped

import java.awt.event.KeyEvent; //导入方法依赖的package包/类
public void keyTyped(KeyEvent k) {

        if (k.getKeyChar() == '\n' && k.isControlDown()) {
            k.consume();
            executeCurrentSQL();
        }
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:8,代码来源:DatabaseManagerSwing.java

示例2: dispatchKeyGeneral

import java.awt.event.KeyEvent; //导入方法依赖的package包/类
/**
 * Handles the keys which have to be enabled all the time in the frame.
 */
private void dispatchKeyGeneral(KeyEvent e) {
    int eventId = e.getID();
    int key = e.getKeyCode();

    handleCloseDialogKeys(key);

    // if the object is the preview of the scribble object, no edit can be done for the it
    if (currentObject instanceof ObjectScribble) {
        return;
    }

    if (eventId == KeyEvent.KEY_PRESSED) {
        if (e.isControlDown()) {
            handleCtrlKey(key);
        } else if (e.isAltDown()) {
            handleAltKey(key);
        } else {
            handleNormalKey(key);
        }
    }
}
 
开发者ID:buni-rock,项目名称:Pixie,代码行数:25,代码来源:BoundingBoxWindow.java

示例3: keyReleased

import java.awt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyReleased(KeyEvent ke) {
    if(ke.getSource() == frame.getjList1()) {
        if(ke.getKeyCode() == KeyEvent.VK_UP ||
            ke.getKeyCode() == KeyEvent.VK_DOWN ||
            ke.getKeyCode() == KeyEvent.VK_ENTER || 
            ke.getKeyCode() == KeyEvent.VK_CONTROL || 
            ke.getKeyCode() == KeyEvent.VK_SPACE) {                
            return;
        } 
    }
    if(ke.isControlDown() && ke.getKeyChar()== KeyEvent.VK_SPACE) {            
        try {
            giveMenuOptions();
            Point loc = new Point(
                    pane.modelToView(pane.getCaretPosition()).x,
                    pane.modelToView(pane.getCaretPosition()).y);                  
            frame.setLocation(pane.getLocationOnScreen().x + loc.x, pane.getLocationOnScreen().y + loc.y + 20);
            frame.setVisible(true);
            frame.getjList1().setSelectedIndex(0);
        } catch (BadLocationException ex) {
            Logger.getLogger(AutocompletionController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
 
开发者ID:Skypr,项目名称:BEAST,代码行数:26,代码来源:AutocompletionController.java

示例4: keyReleased

import java.awt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyReleased(KeyEvent event) {
    if (event.isControlDown() || event.isMetaDown()) {
        switch (event.getKeyCode()) {
            case KeyEvent.VK_C:
                // Copy
                cancelEditing();
                XTableUtils.copyToClipboard(table, false);
                break;
            case KeyEvent.VK_X:
                // Cut
                cancelEditing();
                XTableUtils.copyToClipboard(table, true);
                break;
            case KeyEvent.VK_V:
                // Paste
                cancelEditing();
                XTableUtils.pasteFromClipboard(table);
                break;
            default:
                break;
        }
    }

}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:26,代码来源:ClipboardKeyAdapter.java

示例5: keyPressed

import java.awt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyPressed(KeyEvent e) {
    int step = e.isControlDown() ? 50 : e.isAltDown() ? 1 : 5;
    switch (e.getKeyCode()) {
        case KeyEvent.VK_LEFT:
            setLocation(getX() - step, getY());
            break;
        case KeyEvent.VK_RIGHT:
            setLocation(getX() + step, getY());
            break;
        case KeyEvent.VK_UP:
            setLocation(getX(), getY() - step);
            break;
        case KeyEvent.VK_DOWN:
            setLocation(getX(), getY() + step);
            break;
        case KeyEvent.VK_ESCAPE:
            exitAction.actionPerformed(null);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:Ruler.java

示例6: keyTyped

import java.awt.event.KeyEvent; //导入方法依赖的package包/类
/**
 * Method declaration
 *
 *
 * @param k
 */
public void keyTyped(KeyEvent k) {

    // Strg+Enter or Shift+Enter executes the actual SQL statement in command panel
    if (k.getKeyChar() == '\n'
            && (k.isControlDown() || k.isShiftDown())) {
        k.consume();
        execute();
        layoutCard.show(pCard, "result");
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:17,代码来源:ZaurusDatabaseManager.java

示例7: findActionName

import java.awt.event.KeyEvent; //导入方法依赖的package包/类
public String findActionName(long emulatorID, KeyEvent event) {
	int j = (int) emulatorID;
	ActionTbl[] actionTbl = KEYS_TABLE[j];
	for (int i = 0; actionTbl[i] != null; i++) {
		if ((event.getKeyCode() == actionTbl[i].m_StdKeyCode)
				&& (event.isControlDown() == actionTbl[i].m_StdKeyCtrl)
				&& (event.isShiftDown() == actionTbl[i].m_StdKeyShft)
				&& (event.isAltDown() == actionTbl[i].m_StdKeyAlt)) {
			return (actionTbl[i].m_ActionName);
		}
	}
	return null;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:14,代码来源:JavelinConnectorComposite.java

示例8: keyPressed

import java.awt.event.KeyEvent; //导入方法依赖的package包/类
@Override
    public void keyPressed(KeyEvent e) {
        if (e.getKeyCode() == KeyEvent.VK_ENTER && e.isControlDown()) {
            e.consume();
            if (debuggerRef.get() != null) {
                evaluate();
            }
        }
//        } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
//            e.consume();
//            close();
//        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:CodeEvaluatorUI.java

示例9: keyTyped

import java.awt.event.KeyEvent; //导入方法依赖的package包/类
/**
 * Method declaration
 *
 *
 * @param k
 */
public void keyTyped(KeyEvent k) {

    if (k.getKeyChar() == '\n' && k.isControlDown()) {
        k.consume();
        execute();
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:DatabaseManager.java

示例10: keyTyped

import java.awt.event.KeyEvent; //导入方法依赖的package包/类
public void keyTyped(KeyEvent k) {

        if (k.getKeyChar() == '\n' && k.isControlDown()) {
            k.consume();
            execute();
        }
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:8,代码来源:DatabaseManager.java

示例11: keyTyped

import java.awt.event.KeyEvent; //导入方法依赖的package包/类
public void keyTyped(KeyEvent e) {
	if (e.isControlDown()) {
		if (e.getKeyCode()==KeyEvent.VK_C) copy();
		else if (e.getKeyCode()==KeyEvent.VK_X) cut();
		else if (e.getKeyCode()==KeyEvent.VK_V) paste();
		else if (e.getKeyCode()==KeyEvent.VK_D) delete();
		else if (e.getKeyCode()==KeyEvent.VK_E) edit();
		else if (e.getKeyCode()==KeyEvent.VK_N) newEntry();
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:11,代码来源:XMLJTreeDialog.java

示例12: keyReleased

import java.awt.event.KeyEvent; //导入方法依赖的package包/类
public void keyReleased( KeyEvent evt ) {
		//make sure Digitizer is at the top of the Layer Manager so that segments can be displayed
		moveDigitizerLayerToTop();
		if( evt.getSource()==map && evt.getKeyCode() == KeyEvent.VK_ENTER ) {
			// Not sure if we want the Select Colors dialog anymore.
			// Comment out for now, maybe bring back later.  NSS 06/12/17
//			int[] indices = list.getSelectedIndices();
//			if(objects.size()==0 || indices.length == 0) return;
//			DigitizerObject[] obj = new DigitizerObject[indices.length];
//			for( int i=0 ; i<obj.length ; i++) obj[i] = (DigitizerObject)objects.get(indices[i]);
//			options.showDialog( obj );
//			map.repaint();
		} else if( evt.getSource()==table && evt.isControlDown() ) {
			if( evt.getKeyCode() == KeyEvent.VK_C ) {
				LineSegmentsObject obj = (LineSegmentsObject) table.getModel();
				String dataType = obj.grid.getDataType();
				String units = obj.grid.getUnits();
				StringBuffer sb = new StringBuffer();
				sb.append("Longitude\tLatitude\t"+ dataType + " (" + units + ")\n");
				int[] rows = table.getSelectedRows();
				for( int k=0 ; k<rows.length ; k++ ) {
					sb.append( table.getValueAt(rows[k],0) +"\t");
					sb.append( table.getValueAt(rows[k],1) +"\t");
					sb.append( table.getValueAt(rows[k],2) +"\n");
				}
				JTextArea text = new JTextArea(sb.toString());
				text.selectAll();
				text.cut();
/*
			} else if( evt.getKeyCode() == evt.VK_A ) {
				table.selectAll();
*/
			}
		}
		if(evt.isControlDown() && evt.getKeyCode() == KeyEvent.VK_S ) {
				save();
		}
	
	}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:40,代码来源:Digitizer.java

示例13: ProcesseTeclas

import java.awt.event.KeyEvent; //导入方法依赖的package包/类
/**
 * Recebe as teclas do Editor.
 *
 * @param e
 */
public void ProcesseTeclas(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
        setComando(null);
        return;
    }

    if (e.getKeyCode() == KeyEvent.VK_ENTER) {
        InspectorItemBase ppr = getEditor().getInspectorEditor().FindByProperty("setTexto");
        if (ppr != null) {
            if (getEditor().getInspectorEditor().getSelecionado() == ppr) {
                getEditor().getInspectorEditor().PerformSelect(null);
            }
            getEditor().getInspectorEditor().PerformSelect(ppr);
            if (ppr instanceof InspectorItemExtender) {
                ((InspectorItemExtender) ppr).ExternalRun();
            }
        }
        return;
    }

    if (itensSelecionados.isEmpty()) {
        return;
    }

    FormaElementar item = itensSelecionados.get(0);
    int x = 0, y = 0;
    int inc = 3;
    if (e.isControlDown()) {
        inc = 1;
    }

    switch (e.getKeyCode()) {
        case KeyEvent.VK_LEFT:
            x = -inc;
            y = 0;
            break;
        case KeyEvent.VK_RIGHT:
            x = inc;
            y = 0;
            break;
        case KeyEvent.VK_UP:
            x = 0;
            y = -inc;
            break;
        case KeyEvent.VK_DOWN:
            x = 0;
            y = inc;
            break;
    }

    if (item.isAncorado()) {
        //HidePontosOnSelecao(false);
        e.consume();
    } else if (x != 0 || y != 0) {
        if (e.isShiftDown() && item instanceof Forma) {
            Rectangle rec = new Rectangle(0, 0, -x, -y);
            ((Forma) item).DoFormaResize(rec);
        } else {
            item.DoRaiseMove(x, y);
        }
        superAncorador.Posicione(item);
        DoBaseReenquadreReposicione();
        HidePontosOnSelecao(false);
        PerformInspector();
        e.consume();
    }
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:73,代码来源:Diagrama.java

示例14: isControlOrMetaDown

import java.awt.event.KeyEvent; //导入方法依赖的package包/类
/**
 * Returns whether or not the control modifier is down during the event. This takes the OS into
 * account, so on Mac it will check if the meta modifier is down during the event.
 *
 * @param e
 *            the event
 * @return {@code true} if the control modifier is down on Windows/Linux or the meta modifier is
 *         down on Mac; {@code false} otherwise
 */
public static boolean isControlOrMetaDown(KeyEvent e) {
	if (!IS_MAC) {
		return e.isControlDown();
	} else {
		return e.isMetaDown();
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:17,代码来源:SwingTools.java


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