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


Java SwingTools.isControlOrMetaDown方法代码示例

本文整理汇总了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();
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:46,代码来源:FileTable.java

示例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;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:81,代码来源:AnnotationEventHook.java


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