本文整理了Java中java.awt.event.MouseEvent.isPopupTrigger()
方法的一些代码示例,展示了MouseEvent.isPopupTrigger()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MouseEvent.isPopupTrigger()
方法的具体详情如下:
包路径:java.awt.event.MouseEvent
类名称:MouseEvent
方法名:isPopupTrigger
[英]Returns whether or not this mouse event is the popup menu trigger event for the platform.
Note: Popup menus are triggered differently on different systems. Therefore, isPopupTrigger
should be checked in both mousePressed
and mouseReleased
for proper cross-platform functionality.
[中]返回此鼠标事件是否为平台的弹出菜单触发事件。
注意:弹出菜单在不同系统上的触发方式不同。因此,isPopupTrigger
应同时在mousePressed
和mouseReleased
中进行检查,以获得正确的跨平台功能。
代码示例来源:origin: stanfordnlp/CoreNLP
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger())
treePopup.show(e.getComponent(), e.getX(), e.getY());
}
代码示例来源:origin: wiztools/rest-client
private void showPopup(final MouseEvent e) {
if("".equals(se_response.getText().trim())){
// No response body
return;
}
if (e.isPopupTrigger()) {
bpm.show(e.getComponent(), e.getX(), e.getY());
}
}
});
代码示例来源:origin: nodebox/nodebox
@Override
public void mousePressed(MouseEvent e) {
if (e.isPopupTrigger()) return;
// Pan using the middle mouse button.
if (e.getButton() == MouseEvent.BUTTON2) { //middle mouse pan, does same as below
dragStartPoint = e.getPoint();
isPanning = true;
return;
}
// Zoom by pressing middle mouse button, then left mouse button.
if (isPanning && e.getButton() == MouseEvent.BUTTON1) {
// Center point of the zoom, doesn't change.
zoomStartPoint = e.getPoint();
// The distance the mouse will be dragged when zooming.
zoomEndPoint = e.getPoint();
isZooming = true;
return;
}
// If the space bar and mouse is pressed, we're getting ready to pan the view.
if (isSpacePressed) {
// When panning the view use the original mouse point, not the one affected by the view transform.
dragStartPoint = e.getPoint();
isPanning = true;
}
}
代码示例来源:origin: xyz.cofe/gui.swing
public TableCellMouseEvent( MouseEvent sample ){
super(sample.getComponent(),
sample.getID(),
sample.getWhen(),
sample.getModifiers(),
sample.getX(), sample.getY(),
sample.getXOnScreen(), sample.getYOnScreen(),
sample.getClickCount(),
sample.isPopupTrigger(),
sample.getButton()
);
}
代码示例来源:origin: ron190/jsql-injection
@Override
public void mouseReleased(MouseEvent evt) {
if (evt.isPopupTrigger()) {
// Fix #45348: IllegalComponentStateException on show()
try {
menu.show(evt.getComponent(), evt.getX(), evt.getY());
} catch (IllegalComponentStateException e) {
LOGGER.error(e, e);
}
menu.setLocation(
ComponentOrientation.getOrientation(I18n.getLocaleDefault()) == ComponentOrientation.RIGHT_TO_LEFT
? evt.getXOnScreen() - menu.getWidth()
: evt.getXOnScreen(),
evt.getYOnScreen()
);
}
}
});
代码示例来源:origin: nodebox/nodebox
public void mouseDragged(MouseEvent e) {
isDragging = true;
JComponent c = ColorWell.this;
Point pt = e.getPoint();
JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(c);
pt = SwingUtilities.convertPoint(c, pt, frame.getContentPane());
MouseEvent newEvent = new MouseEvent(colorPicker, e.getID(), e.getWhen(), e.getModifiers(), (int) pt.getX(), (int) pt.getY(), e.getClickCount(), e.isPopupTrigger(), e.getButton());
colorPicker.dispatchEvent(newEvent);
}
代码示例来源:origin: net.imagej/ij
/** Makes a new mouse event from MouseEvent e with the Canvas c
* as source and the coordinates of Point p as X and Y.*/
private MouseEvent adaptEvent(MouseEvent e, Component c, Point p) {
return new MouseEvent(c, e.getID(), e.getWhen(), e.getModifiers(),
p.x, p.y, e.getClickCount(), e.isPopupTrigger());
}
代码示例来源:origin: igniterealtime/Smack
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
popup.show(e.getComponent(), e.getX(), e.getY());
}
}
}
代码示例来源:origin: de.sciss/jtreetable
public TreeTableMouseEvent(TreeTable source, MouseEvent e) {
super(source, e.getID(), e.getWhen(), e.getModifiers(),
e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(),
e.getClickCount(), e.isPopupTrigger(), e.getButton());
}
代码示例来源:origin: magefree/mage
private void checkMenu(MouseEvent Me, SimpleCardView card) {
if (Me.isPopupTrigger()) {
Me.consume();
cardEventSource.fireEvent(card, Me.getComponent(), Me.getX(), Me.getY(), ClientEventType.SHOW_POP_UP_MENU);
}
}
代码示例来源:origin: ron190/jsql-injection
if (mouseEvent.isPopupTrigger()) {
JList<ItemList> list = (JList<ItemList>) mouseEvent.getSource();
this.dndList.dropPasteFile(
Arrays.asList(importFileDialog.getSelectedFiles()),
this.dndList.locationToIndex(mouseEvent.getPoint())
);
popupMenuList.show(
list,
ComponentOrientation.getOrientation(I18n.getLocaleDefault()) == ComponentOrientation.RIGHT_TO_LEFT
? mouseEvent.getX() - popupMenuList.getWidth()
: mouseEvent.getX(),
mouseEvent.getY()
);
} catch (IllegalComponentStateException e) {
代码示例来源:origin: nodebox/nodebox
public void mouseDragged(MouseEvent e) {
isDragging = true;
JComponent c = ColorWell.this;
Point pt = e.getPoint();
JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(c);
pt = SwingUtilities.convertPoint(c, pt, frame.getContentPane());
MouseEvent newEvent = new MouseEvent(colorPicker, e.getID(), e.getWhen(), e.getModifiers(), (int) pt.getX(), (int) pt.getY(), e.getClickCount(), e.isPopupTrigger(), e.getButton());
colorPicker.dispatchEvent(newEvent);
}
代码示例来源:origin: protegeproject/protege
public void mouseReleased(MouseEvent e) {
if (e.getClickCount() == 3 && e.isControlDown() && e.isShiftDown()) {
reload();
}
if (e.isPopupTrigger()) {
showPopupMenu(e);
}
}
代码示例来源:origin: nodebox/nodebox
public void mousePressed(MouseEvent e) {
if (e.isPopupTrigger()) {
showPopup(e);
} else if (isDragTrigger(e)) {
} else {
Point2D pt = inverseViewTransformPoint(e.getPoint());
代码示例来源:origin: igniterealtime/Smack
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
popup.show(e.getComponent(), e.getX(), e.getY());
}
}
}
代码示例来源:origin: net.java.openjdk.cacio/cacio-shared
void handleMouseMotionEvent(MouseEvent e) {
MouseEvent me = new MouseEvent(this, e.getID(), e.getWhen(),
e.getModifiers(), e.getX(), e.getY(),
e.getXOnScreen(), e.getYOnScreen(),
e.getClickCount(), e.isPopupTrigger(),
e.getButton());
// IMPORTANT: See comment on the helper method!
doLightweightDispatching(e);
}
代码示例来源:origin: magefree/mage
private void checkMenu(MouseEvent Me, SimpleCardView card) {
if (Me.isPopupTrigger()) {
Me.consume();
cardEventSource.fireEvent(card, Me.getComponent(), Me.getX(), Me.getY(), ClientEventType.SHOW_POP_UP_MENU);
}
}
代码示例来源:origin: igniterealtime/Smack
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
popup.show(e.getComponent(), e.getX(), e.getY());
}
}
}
代码示例来源:origin: net.java.openjdk.cacio/cacio-shared
void handleMouseEvent(MouseEvent e) {
MouseEvent me = new MouseEvent(this, e.getID(), e.getWhen(),
e.getModifiers(), e.getX(), e.getY(),
e.getXOnScreen(), e.getYOnScreen(),
e.getClickCount(), e.isPopupTrigger(),
e.getButton());
// IMPORTANT: See comment on the helper method!
doLightweightDispatching(e);
}
代码示例来源:origin: ron190/jsql-injection
/**
* Fix compatibility issue with right click on Linux.
* @param e Mouse event
*/
private void showPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
JTree tree = (JTree) e.getSource();
TreePath path = tree.getPathForLocation(e.getX(), e.getY());
if (path == null) {
return;
}
DefaultMutableTreeNode currentTableNode = (DefaultMutableTreeNode) path.getLastPathComponent();
if (currentTableNode.getUserObject() instanceof AbstractNodeModel) {
AbstractNodeModel currentTableModel = (AbstractNodeModel) currentTableNode.getUserObject();
if (currentTableModel.isPopupDisplayable()) {
currentTableModel.showPopup(currentTableNode, path, e);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!