本文整理了Java中java.awt.event.MouseEvent.getID()
方法的一些代码示例,展示了MouseEvent.getID()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MouseEvent.getID()
方法的具体详情如下:
包路径:java.awt.event.MouseEvent
类名称:MouseEvent
方法名:getID
暂无
代码示例来源:origin: runelite/runelite
private MouseEvent translateEvent(MouseEvent e)
{
Dimension stretchedDimensions = client.getStretchedDimensions();
Dimension realDimensions = client.getRealDimensions();
int newX = (int) (e.getX() / (stretchedDimensions.width / realDimensions.getWidth()));
int newY = (int) (e.getY() / (stretchedDimensions.height / realDimensions.getHeight()));
return new MouseEvent((Component) e.getSource(), e.getID(), e.getWhen(), e.getModifiersEx(),
newX, newY, e.getClickCount(), e.isPopupTrigger(), e.getButton());
}
}
代码示例来源: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: org.netbeans.api/org-openide-awt
/** Returns true if parametr is a 'doubleclick event'
* @param e MouseEvent
* @return true if the event is a doubleclick
*/
public static boolean isDoubleClick(MouseEvent e) {
// even number of clicks is considered like doubleclick
// it works as well as 'normal testing against 2'
// but on solaris finaly works and on Win32 works better
//System.out.println ("Click COunt: "+e.getClickCount ()); // NOI18N
// If you don't do this, then if anyone calls isDoubleClick from
// say a mouseReleased method, then the immediately following mouseClicked
// method from a single mouse click will give isDoubleClick=true
if ((e.getID() != MouseEvent.MOUSE_CLICKED) || (e.getClickCount() == 0)) {
return false;
}
return ((e.getClickCount() % 2) == 0) || isDoubleClickImpl(e);
}
代码示例来源:origin: nodebox/nodebox
@Override
protected void processMouseEvent(MouseEvent e) {
if (e.getID() == MouseEvent.MOUSE_PRESSED) {
int width = getWidth() - WIDTH_OFFSET;
int x = e.getX();
if (x < HALF_WIDTH_OFFSET)
panel.setValue(0);
else if (x > width + WIDTH_OFFSET)
panel.setValue(1);
else
panel.setValue((float) (x - HALF_WIDTH_OFFSET) / width);
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
private MouseEvent clearClicks(MouseEvent e) {
// Clears doubleclicks to prevent misses when switching sort order
MouseEvent ee = new MouseEvent((Component)e.getSource(), e.getID(), e.getWhen(),
e.getModifiers(), e.getX(), e.getY(),
1, e.isPopupTrigger(), e.getButton());
return ee;
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
private void fireActionEvent(MouseEvent e) {
ActionEvent ae = new ActionEvent(e.getSource(), e.getID(),
e.paramString(), e.getWhen(),
e.getModifiers());
listener.actionPerformed(ae);
}
private boolean isButtonDown(MouseEvent e) {
代码示例来源:origin: checkstyle/checkstyle
if (getColumnClass(counter) == ParseTreeTableModel.class) {
final MouseEvent mouseEvent = (MouseEvent) event;
final MouseEvent newMouseEvent = new MouseEvent(tree, mouseEvent.getID(),
mouseEvent.getWhen(), mouseEvent.getModifiersEx(),
mouseEvent.getX() - getCellRect(0, counter, true).x,
mouseEvent.getY(), mouseEvent.getClickCount(),
mouseEvent.isPopupTrigger());
tree.dispatchEvent(newMouseEvent);
代码示例来源:origin: nodebox/nodebox
@Override
protected void processMouseMotionEvent(MouseEvent e) {
if (e.getID() == MouseEvent.MOUSE_DRAGGED) {
int width = getWidth() - WIDTH_OFFSET;
int x = e.getX();
if (x < HALF_WIDTH_OFFSET)
panel.setValue(0);
else if (x > width + WIDTH_OFFSET)
panel.setValue(1);
else
panel.setValue((float) (x - HALF_WIDTH_OFFSET) / width);
}
}
}
代码示例来源: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: org.swinglabs.swingx/swingx-all
/**
* Overridden to exclude clickcounts > 1.
*/
@Override
protected boolean mightBeExpansionTrigger(EventObject e) {
if (!(e instanceof MouseEvent)) return false;
MouseEvent me = (MouseEvent) e;
if (!SwingUtilities.isLeftMouseButton(me)) return false;
if (me.getClickCount() > 1) return false;
return me.getID() == MouseEvent.MOUSE_PRESSED;
}
代码示例来源:origin: geotools/geotools
/**
* Creates a new event instance.
*
* @param pane the source map pane
* @param event the source mouse event
*/
public MapMouseEvent(MapPane pane, MouseEvent event) {
super(
(Component) pane,
event.getID(),
event.getWhen(),
event.getModifiers(),
event.getX(),
event.getY(),
event.getClickCount(),
event.isPopupTrigger(),
event.getButton());
worldCoords = calculateWorldPos(pane, event);
isWheelEvent = false;
wheelAmount = 0;
}
代码示例来源:origin: magefree/mage
if (e.getID() == MouseEvent.MOUSE_DRAGGED || e.getID() == MouseEvent.MOUSE_MOVED) {
allowedEvent = true;
popupComponent = SwingUtilities.getDeepestComponentAt(e.getComponent(), e.getX(), e.getY()); // show root component (popups creates at root)
if (popupComponent != null && popupComponent.getClass().getName().contains("BasicComboPopup")) {
popupEvent = SwingUtilities.convertMouseEvent((Component) e.getSource(), e, popupComponent);
代码示例来源: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: com.haulmont.thirdparty/swingx-core
/**
* Overridden to exclude clickcounts > 1.
*/
@Override
protected boolean mightBeExpansionTrigger(EventObject e) {
if (!(e instanceof MouseEvent)) return false;
MouseEvent me = (MouseEvent) e;
if (!SwingUtilities.isLeftMouseButton(me)) return false;
if (me.getClickCount() > 1) return false;
return me.getID() == MouseEvent.MOUSE_PRESSED;
}
代码示例来源:origin: org.microemu/microemu-javase-swing
private MouseEvent createAdaptedMouseEvent(MouseEvent e, int scale) {
return new MouseEvent(e.getComponent(), e.getID(), e.getWhen(), e.getModifiers(), e.getX() / scale, e
.getY()
/ scale, e.getClickCount(), e.isPopupTrigger(), e.getButton());
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mercurial
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
e.consume();
createPopup(e).show(e.getComponent(),
e.getX(), e.getY());
} else if (e.getID() == MouseEvent.MOUSE_RELEASED && e.getButton() == MouseEvent.BUTTON1) {
e.consume();
showTooltipWindow(e);
}
}
});
代码示例来源:origin: imagej/ImageJA
/** 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: org.swinglabs.swingx/swingx-core
/**
* Overridden to exclude clickcounts > 1.
*/
@Override
protected boolean mightBeExpansionTrigger(EventObject e) {
if (!(e instanceof MouseEvent)) return false;
MouseEvent me = (MouseEvent) e;
if (!SwingUtilities.isLeftMouseButton(me)) return false;
if (me.getClickCount() > 1) return false;
return me.getID() == MouseEvent.MOUSE_PRESSED;
}
代码示例来源: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: Blazemeter/jmeter-bzm-plugins
private void dispatchEvent(MouseEvent me) {
if (rect != null && rect.contains(me.getX(), me.getY())) {
dispatchEvent(me, me.getID());
}
}
内容来源于网络,如有侵权,请联系作者删除!