本文整理了Java中java.awt.event.MouseEvent.getWhen()
方法的一些代码示例,展示了MouseEvent.getWhen()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MouseEvent.getWhen()
方法的具体详情如下:
包路径:java.awt.event.MouseEvent
类名称:MouseEvent
方法名:getWhen
暂无
代码示例来源: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: bobbylight/RSyntaxTextArea
int nclicks = e.getClickCount();
null, e.getWhen(), e.getModifiers()));
代码示例来源: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: 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: org.jspresso.framework/jspresso-swing-application
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
ActionEvent ae = new ActionEvent(e.getSource(), ActionEvent.ACTION_PERFORMED, null, e.getWhen(),
e.getModifiers());
rowAction.actionPerformed(ae);
}
}
});
代码示例来源: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: 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.jspresso.framework/jspresso-swing-application
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
ActionEvent ae = new ActionEvent(e.getSource(), ActionEvent.ACTION_PERFORMED, null, e.getWhen(),
e.getModifiers());
rowAction.actionPerformed(ae);
}
}
});
代码示例来源: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.jspresso.framework/jspresso-swing-application
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
ActionEvent ae = new ActionEvent(e.getSource(), ActionEvent.ACTION_PERFORMED, null, e.getWhen(),
e.getModifiers());
rowAction.actionPerformed(ae);
}
}
});
代码示例来源: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: org.piccolo2d/piccolo2d-core
public MouseEvent buildModifiedMouseEvent(final MouseEvent e, final int newType, final int newButton) {
return new MouseEvent((Component) e.getSource(), newType, e.getWhen(), e.getModifiers(), e.getX(),
e.getY(), e.getClickCount(), e.isPopupTrigger(), newButton);
}
代码示例来源: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.gephi/visualization
private MouseEvent convertMouseEvent(java.awt.event.MouseEvent me) {
return new MouseEvent((short) 0, me.getSource(), me.getWhen(), me.getModifiers(), me.getX(), me.getY(), (short) me.getClickCount(), (short) me.getButton(), me instanceof MouseWheelEvent ? new float[]{0, -((MouseWheelEvent) me).getUnitsToScroll()} : null, 1f);
}
}
代码示例来源: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.eas.platypus/platypus-js-scalable-widget
protected static MouseEvent cloneMouseEvent(MouseEvent me, Object source, int eId, Point pt) {
if (source != null && source instanceof Component) {
return new MouseEvent((Component) source, eId, me.getWhen(), me.getModifiers(), pt.x, pt.y, me.getXOnScreen(), me.getYOnScreen(), me.getClickCount(), me.isPopupTrigger(), me.getButton());
} else {
return me;
}
}
代码示例来源:origin: sdedit/sdedit
private MouseEvent translate(MouseEvent e) {
int x = (int) (e.getX() / scale);
int y = (int) (e.getY() / scale);
return new MouseEvent((Component) e.getSource(), e.getID(),
e.getWhen(), e.getModifiers(), x, y, e.getClickCount(), e
.isPopupTrigger(), e.getButton());
}
代码示例来源:origin: stackoverflow.com
public class yourMouseListener extends MouseAdapter{
//this will be called when mouse is pressed on the component
public void mousePressed(MouseEvent me) {
if (/*do your controls to decide if you want to propagate the event*/){
Component child = me.getComponent();
Component parent = child.getParent();
//transform the mouse coordinate to be relative to the parent component:
int deltax = child.getX() + me.getX();
int deltay = child.getY() + me.getY();
//build new mouse event:
MouseEvent parentMouseEvent =new MouseEvent(parent, MouseEvent.MOUSE_PRESSED, me.getWhen(), me.getModifiers(),deltax, deltay, me.getClickCount(), false)
//dispatch it to the parent component
parent.dispatchEvent( parentMouseEvent);
}
}
}
代码示例来源: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: cpesch/RouteConverter
private void ensureSelection(MouseEvent e, int selectedRowCountMinimum) {
if (!table.hasFocus())
table.requestFocus();
if (table.getSelectedRowCount() < selectedRowCountMinimum) {
// dispatch event again as a left mouse click for selections
// (do not try to spare one of the three events)
table.dispatchEvent(new MouseEvent((Component) e.getSource(), MOUSE_PRESSED, e.getWhen(),
BUTTON1_MASK, e.getX(), e.getY(),
e.getClickCount(), false));
table.dispatchEvent(new MouseEvent((Component) e.getSource(), MOUSE_RELEASED, e.getWhen(),
BUTTON1_MASK, e.getX(), e.getY(),
e.getClickCount(), false));
table.dispatchEvent(new MouseEvent((Component) e.getSource(), MOUSE_CLICKED, e.getWhen(),
BUTTON1_MASK, e.getX(), e.getY(),
e.getClickCount(), false));
}
}
内容来源于网络,如有侵权,请联系作者删除!