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


Java MouseEvent.isControlDown方法代码示例

本文整理汇总了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);
            }
        }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:24,代码来源:TableSorter.java

示例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();
    }
}
 
开发者ID:VISNode,项目名称:VISNode,代码行数:17,代码来源:JNodeContainer.java

示例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);
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:18,代码来源:XYGraph.java

示例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();
            }
        }
    }
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:20,代码来源:GEFComponent.java

示例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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:TableSorter.java

示例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);
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:24,代码来源:RegionGrid.java

示例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);
    }
  }
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:29,代码来源:mxGraphHandler.java

示例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();
}
 
开发者ID:anousv,项目名称:OrthancAnonymization,代码行数:24,代码来源:TablePatientsMouseListener.java

示例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);
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:22,代码来源:TableSorter.java

示例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();
	
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:22,代码来源:LineSegmentsObject.java

示例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;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:15,代码来源:mxGraphComponent.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:DropTargetLayer.java

示例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;
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:8,代码来源:HumanVsComputerThrottleController.java

示例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;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:30,代码来源:PDB.java

示例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();
        }
    }
}
 
开发者ID:onprom,项目名称:onprom,代码行数:13,代码来源:AttributeTable.java


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