本文整理汇总了Java中com.rapidminer.gui.tools.SwingTools.isControlOrMetaDown方法的典型用法代码示例。如果您正苦于以下问题:Java SwingTools.isControlOrMetaDown方法的具体用法?Java SwingTools.isControlOrMetaDown怎么用?Java SwingTools.isControlOrMetaDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rapidminer.gui.tools.SwingTools
的用法示例。
在下文中一共展示了SwingTools.isControlOrMetaDown方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mousePressed
import com.rapidminer.gui.tools.SwingTools; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
this.mpx = e.getX();
this.mpy = e.getY();
this.mouseDownFlag = true;
evaluateClick(e);
if (e.getSource() instanceof JTable && !this.mouseDragging) {
this.row = ((JTable) e.getComponent()).rowAtPoint(e.getPoint());
this.column = ((JTable) e.getComponent()).columnAtPoint(e.getPoint());
if (this.row < 0) {
return;
}
int x = (int) this.tableHeader.getHeaderRect(this.mainColumnIndex).getX();
int y = 0;
this.counter++;
y = (this.row - 1) * this.getRowHeight() + this.getHeaderHeight();
Dimension d = ((FileTableLabel) this.getValueAt(this.row, this.mainColumnIndex)).getPreferredSize();
Rectangle r = new Rectangle(x, y, Math.min((int) d.getWidth(),
this.getColumnModel().getColumn(this.mainColumnIndex).getWidth()), this.getRowHeight(this.row));
if (r.contains(e.getPoint())) {
if (SwingTools.isControlOrMetaDown(e)) {
if (this.isCellSelected(this.row, this.mainColumnIndex)) {
if (!e.isPopupTrigger()) {
this.getSelectionModel().removeSelectionInterval(this.row, this.row);
}
} else {
updateSelectionInterval(this.row, true);
}
} else {
if (this.isCellSelected(this.row, this.mainColumnIndex)) {
// do nothing
} else {
updateSelectionInterval(this.row, false);
}
}
} else {
clearSelection();
}
}
synchFilechooser();
}
示例2: processMouseEvent
import com.rapidminer.gui.tools.SwingTools; //导入方法依赖的package包/类
@Override
public void processMouseEvent(final ExecutionUnit process, final MouseEventType type, final MouseEvent e) {
if (!visualizer.isActive()) {
return;
}
Point point = rendererModel.getMousePositionRelativeToProcess();
if (point == null) {
point = e.getPoint();
}
switch (type) {
case MOUSE_CLICKED:
if (!SwingUtilities.isLeftMouseButton(e)) {
break;
}
if (process != null && e.getClickCount() >= 2) {
if (!AnnotationDrawer.isProcessInteractionHappening(rendererModel)) {
double x = Math.max(WorkflowAnnotation.MIN_X, point.getX());
double y = Math.max(WorkflowAnnotation.MIN_Y, point.getY());
ProcessAnnotation anno = new ProcessAnnotation(
I18N.getGUILabel("workflow.annotation.default_text.label"), new AnnotationStyle(),
process, false, false, new Rectangle2D.Double(x, y, ProcessAnnotation.DEFAULT_WIDTH,
ProcessAnnotation.DEFAULT_HEIGHT));
model.addProcessAnnotation(anno);
decorator.editSelected();
e.consume();
}
}
break;
case MOUSE_ENTERED:
case MOUSE_MOVED:
if (process != null) {
WorkflowAnnotations annotations = rendererModel.getProcessAnnotations(process);
if (updateHoveredStatus(point, process, annotations)) {
e.consume();
} else {
model.setHovered(null, null);
}
}
break;
case MOUSE_EXITED:
if (!SwingTools.isMouseEventExitedToChildComponents(view, e)) {
model.setHovered(null, null);
}
break;
case MOUSE_DRAGGED:
model.setHovered(null, null);
break;
case MOUSE_PRESSED:
if ((SwingTools.isControlOrMetaDown(e) || e.isShiftDown()) && e.getButton() == 1) {
return;
}
if (SwingUtilities.isLeftMouseButton(e) || SwingUtilities.isRightMouseButton(e)) {
if (model.getHovered() != null) {
model.setSelected(model.getHovered());
model.startDragOrResize(e, point, false);
e.consume();
// linux/mac only, otherwise the first click will only select
if (e.isPopupTrigger()) {
visualizer.showPopupMenu(e);
return;
}
} else {
if (model.getSelected() != null) {
model.setSelected(null);
// if context menu on process should open, don't prevent it
if (!e.isPopupTrigger()) {
e.consume();
}
}
}
}
break;
case MOUSE_RELEASED:
default:
break;
}
}