本文整理汇总了Java中java.awt.event.MouseEvent.isControlDown方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.isControlDown方法的具体用法?Java MouseEvent.isControlDown怎么用?Java MouseEvent.isControlDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.isControlDown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseClicked
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseClicked(MouseEvent e) {
JTableHeader h = (JTableHeader) e.getSource();
TableColumnModel columnModel = h.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
int column = columnModel.getColumn(viewColumn).getModelIndex();
if (column != -1) {
int status = getSortingStatus(column);
if (!e.isControlDown()) {
cancelSorting();
}
// Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or
// {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed.
status = status + (e.isShiftDown() ? -1
: 1);
status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
setSortingStatus(column, status);
}
}
示例2: mouseReleased
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseReleased(MouseEvent e) {
if (e.getSource() instanceof JNode) {
// If there weren't multiple selection or component has draged
if (!e.isControlDown() || !e.getLocationOnScreen().equals(pressedPosition)) {
return;
}
JNode node = (JNode) e.getSource();
// It is a new node
if (!oldSelection.contains(node)) {
return;
}
selection.remove(node);
node.repaint();
}
}
示例3: checkEdge
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
void checkEdge(MouseEvent e) {
if( e.isControlDown() )return;
if( !(xy instanceof ScalableXYPoints) )return;
int[] wesn = getWESN();
int cursor = 0;
int x = e.getX();
int y = e.getY();
if( tracksWidth || scPane==null) {
if( (int)Math.abs(x-wesn[0])<2 ) cursor=10;
else if( (int)Math.abs(x-wesn[1])<2 ) cursor=11;
}
if( (tracksHeight || scPane==null) && cursor==0 ) {
if( (int)Math.abs(y-wesn[2])<2 ) cursor=8;
else if( (int)Math.abs(y-wesn[3])<2 ) cursor=9;
}
setCursor(cursor);
}
示例4: mousePressed
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1) {
Bounds[] bounds = selection.getBounds();
mousePressed(translateMouseEvent(e));
if (e.isControlDown()) {
Bounds[] bounds2 = selection.getBounds();
if (!Arrays.equals(bounds, bounds2)) {
Bounds[] bounds3 = Arrays.copyOf(bounds, bounds.length
+ bounds2.length);
for (int i = 0; i < bounds2.length; i++) {
bounds3[i + bounds.length] = bounds2[i];
}
selection.setBounds(bounds3);
selectionChanged();
}
}
}
}
示例5: mouseClicked
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseClicked(MouseEvent e) {
JTableHeader h = (JTableHeader) e.getSource();
TableColumnModel columnModel = h.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
int column = columnModel.getColumn(viewColumn).getModelIndex();
if (column != -1) {
int status = getSortingStatus(column);
if (!e.isControlDown()) {
cancelSorting();
}
// Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or
// {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed.
status = status + (e.isShiftDown() ? -1 : 1);
status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
setSortingStatus(column, status);
}
}
示例6: mousePressed
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mousePressed(MouseEvent e) {
final Point p = e.getPoint();
lastClick = p;
lastClickedRegion = grid.getRegion(p);
if (!e.isShiftDown() && !e.isControlDown() &&
(lastClickedRegion==null || !lastClickedRegion.isSelected())) {
unSelectAll();
}
if (lastClickedRegion == null) {
anchor = p;
selectionRect = new Rectangle(anchor.x, anchor.y, 0, 0);
}
else {
if (e.isControlDown()) {
unselect(lastClickedRegion);
}
else {
select(lastClickedRegion);
}
}
}
示例7: moveCells
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
*
* @param dx
* @param dy
* @param e
*/
protected void moveCells(Object[] cells, double dx, double dy, Object target, MouseEvent e) {
mxGraph graph = graphComponent.getGraph();
boolean clone = e.isControlDown() && isCloneEnabled();
if (clone) {
cells = graph.getCloneableCells(cells);
}
if (cells.length > 0) {
// Removes cells from parent
if (target == null && isRemoveCellsFromParent()
&& shouldRemoveCellFromParent(graph.getModel().getParent(initialCell), cells, e)) {
target = graph.getDefaultParent();
}
Object[] tmp = graph.moveCells(cells, dx, dy, clone, target, e.getPoint());
if (isSelectEnabled() && clone && tmp != null && tmp.length == cells.length) {
graph.setSelectionCells(tmp);
}
}
}
示例8: mousePressed
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent event) {
this.modeleStudies.clear();
this.modeleSeries.clear();
if(!event.isControlDown()){
// selects the row at which point the mouse is clicked
Point point = event.getPoint();
int currentRow = tableau.rowAtPoint(point);
tableau.setRowSelectionInterval(currentRow, currentRow);
}
try {
if(this.modele.getRowCount() != 0){
String patientName = (String)this.tableau.getValueAt(this.tableau.getSelectedRow(), 0);
String patientID = (String)this.tableau.getValueAt(this.tableau.getSelectedRow(), 1);
String patientUID = (String)this.tableau.getValueAt(this.tableau.getSelectedRow(), 2);
this.modeleStudies.addStudy(patientName, patientID, patientUID);
this.tableauStudies.setRowSelectionInterval(0,0);
}
}catch (Exception e1) {
e1.printStackTrace();
}
frame.pack();
}
示例9: mouseClicked
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
JTableHeader h = (JTableHeader) e.getSource();
TableColumnModel columnModel = h.getColumnModel();
int viewColumn = columnModel.getColumnIndexAtX(e.getX());
int column = columnModel.getColumn(viewColumn).getModelIndex();
if (column != -1) {
int status = getSortingStatus(column);
if (!e.isControlDown()) {
cancelSorting();
}
// Cycle the sorting states through {NOT_SORTED, ASCENDING,
// DESCENDING} or
// {NOT_SORTED, DESCENDING, ASCENDING} depending on whether
// shift is pressed.
status = status + (e.isShiftDown() ? -1 : 1);
status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0,
// 1}
setSortingStatus(column, status);
}
}
示例10: mouseReleased
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseReleased( MouseEvent evt ) {
if( editShape==null ) {
currentPoint = -1;
return;
}
drawEdit();
editShape = null;
if( evt.isControlDown() || evt.getWhen()-when<500L ) {
currentPoint = -1;
return;
}
Point2D.Double p = (Point2D.Double)map.getScaledPoint( evt.getPoint() );
double[] xyz = (double[])points.get( currentPoint );
xyz[0] = p.x - currentOffset;
xyz[1] = p.y;
xyz[2] = getZ(p);
fireTableRowsUpdated(currentPoint, currentPoint);
dig.makeProfile();
map.repaint();
}
示例11: isToggleEvent
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
*
* @param event
* @return Returns true if the given event should toggle selected cells.
*/
public boolean isToggleEvent(MouseEvent event) {
// NOTE: IsMetaDown always returns true for right-clicks on the Mac, so
// toggle selection for left mouse buttons requires CMD key to be pressed,
// but toggle for right mouse buttons requires CTRL to be pressed.
return (event != null) ? ((mxUtils.IS_MAC)
? ((SwingUtilities.isLeftMouseButton(event) && event.isMetaDown())
|| (SwingUtilities.isRightMouseButton(event) && event.isControlDown()))
: event.isControlDown()) : false;
}
示例12: isMultiselectPressed
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public static boolean isMultiselectPressed(MouseEvent evt) {
if(evt.isShiftDown()) {
return true;
}
if(!isAqua() && evt.isControlDown()) {
return true;
}
return false;
}
示例13: isControl
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
private boolean isControl(MouseEvent e) {
if (!e.isShiftDown() && e.isControlDown() && !e.isAltDown()) {
return true;
} else {
return false;
}
}
示例14: mouseClicked
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseClicked(MouseEvent e) {
if(e.isControlDown())return;
Point2D p = map.getScaledPoint( e.getPoint() );
int index = getClickedIndex(p);
if( index==-1 ) {
if(e.isShiftDown()) return;
table.clearSelection();
current = -1;
} else if(e.isShiftDown()) {
if( index==current) {
table.removeRowSelectionInterval(index, index);
table.getRowHeader().setSelectedIndices(table.getSelectedRows());
current = -1;
return;
}
current = index;
table.addRowSelectionInterval(index, index);
table.getRowHeader().setSelectedIndices(table.getSelectedRows());
table.ensureIndexIsVisible( index);
table.getRowHeader().repaint();
} else {
current = index;
table.setRowSelectionInterval(index, index);
table.getRowHeader().setSelectedIndices(table.getSelectedRows());
table.ensureIndexIsVisible( index);
table.getRowHeader().repaint();
}
return;
}
示例15: mouseClicked
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2 || e.isPopupTrigger()) {
if (e.isControlDown()) {
if (getSelectedRow() > -1) {
removeSelectedAttribute();
}
} else {
addEmptyAttribute();
}
}
}