本文整理汇总了Java中javax.swing.SwingUtilities.isMiddleMouseButton方法的典型用法代码示例。如果您正苦于以下问题:Java SwingUtilities.isMiddleMouseButton方法的具体用法?Java SwingUtilities.isMiddleMouseButton怎么用?Java SwingUtilities.isMiddleMouseButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.SwingUtilities
的用法示例。
在下文中一共展示了SwingUtilities.isMiddleMouseButton方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseClicked
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void mouseClicked(MouseEvent e) {
if(e.isConsumed()) return;
boolean activate = false;
HyperlinkType type = getHyperlinkType(e);
if ( type != null ) {
activate = !e.isPopupTrigger() && e.getClickCount() == 1 && SwingUtilities.isLeftMouseButton(e);
} else if ( Utilities.isWindows() && e.getClickCount() == 1 && SwingUtilities.isMiddleMouseButton(e) ) {
activate = true;
type = HyperlinkType.GO_TO_DECLARATION;
}
if ( activate ) {
int position = component.viewToModel(e.getPoint());
if (position < 0) {
return ;
}
performAction(position, type);
}
}
示例2: mouseClicked
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
if (tabbedPane.getSelectedIndex() != -1) {
Rectangle rect = tabbedPane.getUI().getTabBounds(tabbedPane, tabbedPane.getSelectedIndex());
if (rect.contains(e.getPoint())) {
if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 2) {
if (checkIndexContains()) {
startEditing();
}
} else if (SwingUtilities.isMiddleMouseButton(e)) {
if (onMiddleClickAction != null) {
onMiddleClickAction.actionPerformed(null);
}
}
} else {
renameTabTitle();
}
}
}
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:21,代码来源:TabTitleEditListener.java
示例3: processEvent
import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private static void processEvent(int eventType, MouseEvent e) {
if (eventCount >= BUTTON_EVENTS_SEQUENCE.length) {
throw new RuntimeException("Unexpected event " + e);
}
int[] arr = BUTTON_EVENTS_SEQUENCE[eventCount];
if (arr[0] != eventType) {
throw new RuntimeException("Unexpected eventType " + eventType + "on step " + eventCount);
}
boolean result;
switch (arr[1]) {
case 1:
result = SwingUtilities.isLeftMouseButton(e);
break;
case 2:
result = SwingUtilities.isMiddleMouseButton(e);
break;
case 3:
result = SwingUtilities.isRightMouseButton(e);
break;
default:
throw new RuntimeException("Incorrect arr[1] on step " + eventCount);
}
if (!result) {
throw new RuntimeException("Test failed on step " + eventCount);
}
eventCount++;
}