本文整理汇总了Java中java.awt.event.MouseEvent.getY方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.getY方法的具体用法?Java MouseEvent.getY怎么用?Java MouseEvent.getY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.getY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseReleased
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public synchronized void mouseReleased(MouseEvent e) {
if ((e.getX() > 0 && e.getX() < X_SIZE) && (e.getY() > 0 && e.getY() < AD_HEIGHT)) {
if ((System.currentTimeMillis() - lastMouseReleaseTime > 500) && url != null
&& (!url.equals(""))) {
try {
WebLinkManager.openURL(new URL(url));
} catch (MalformedURLException ex) {
ex.printStackTrace();
}
}
lastMouseReleaseTime = System.currentTimeMillis(); //so that
// double -
// triple
// clicks by
// spastic
// people
// don't
// generate
// multipe
// browsers
}
}
示例2: mousePressed
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mousePressed(MouseEvent e) {
selected = -1;
double minDist = Float.MAX_VALUE;
for (int i = 0; i < polygon.npoints; ++i) {
double dist = Point2D.distance(polygon.xpoints[i], polygon.ypoints[i], e.getX(), e.getY());
if (dist < minDist) {
minDist = dist;
selected = i;
}
}
if (e.isMetaDown()) {
polygon.addPoint(e.getX(), e.getY());
if (selected >= 0) {
for (int i = polygon.npoints - 1; i > selected; --i) {
polygon.xpoints[i] = polygon.xpoints[i - 1];
polygon.ypoints[i] = polygon.ypoints[i - 1];
}
polygon.xpoints[selected] = e.getX();
polygon.ypoints[selected] = e.getY();
}
}
}
示例3: PickContext
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
* Constructs a pick context for the specified mouse event.
* @param event the mouse event.
*/
public PickContext(MouseEvent event) {
super((ViewCanvas)event.getSource());
_event = event;
int xp = event.getX();
int yp = event.getY();
// The near endpoint.
Point3 near = new Point3(xp,yp,0.0);
// The far endpoint.
Point3 far = new Point3(xp,yp,1.0);
// The pick segment, transformed to world coordinates.
_pickSegment = new Segment(near,far);
_pickSegment.transform(getPixelToWorld());
_nearPoint = _pickSegment.getA();
_farPoint = _pickSegment.getB();
}
示例4: isDragPossible
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
* Determines if the following are true:
* <ul>
* <li>the press event is located over a selection
* <li>the dragEnabled property is true
* <li>A TranferHandler is installed
* </ul>
* <p>
* This is implemented to check for a TransferHandler.
* Subclasses should perform the remaining conditions.
*/
protected boolean isDragPossible(MouseEvent e) {
JComponent comp = getEventComponent(e);
boolean possible = (comp == null) ? false : (comp.getTransferHandler() != null);
if (possible) {
JTextComponent c = (JTextComponent) getEventComponent(e);
if (c.getDragEnabled()) {
Caret caret = c.getCaret();
int dot = caret.getDot();
int mark = caret.getMark();
if (dot != mark) {
Point p = new Point(e.getX(), e.getY());
int pos = c.viewToModel(p);
int p0 = Math.min(dot, mark);
int p1 = Math.max(dot, mark);
if ((pos >= p0) && (pos < p1)) {
return true;
}
}
}
}
return false;
}
示例5: mousePressed
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
e.consume();
switch (mode) {
case LINES:
x1 = e.getX();
y1 = e.getY();
x2 = -1;
break;
case POINTS:
default:
colors.add(getForeground());
lines.add(new Rectangle(e.getX(), e.getY(), -1, -1));
x1 = e.getX();
y1 = e.getY();
repaint();
break;
}
}
示例6: mouseMoved
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
* checks if the mouse position is over a part of the code which contains an error.
* if so, it displays a popupmenu with the error message
* @param e
*/
@Override
public void mouseMoved(MouseEvent e) {
Point pt = new Point(e.getX(), e.getY());
int pos = pane.viewToModel(pt);
if(pos == JTextPaneToolbox.getText(pane).length()) {
pane.setToolTipText(null);
//errorPopupMenu.setVisible(false);
return;
}
if(Math.abs(errorPopupMenu.getLocation().x - pt.getX()) < 10 &&
Math.abs(errorPopupMenu.getLocation().x - pt.getX()) < 10 && errorPopupMenu.isVisible()) return;
for(int i = 0; i < absPosToMsg.size(); ++i) {
if(absPosToMsg.get(i).x <= pos && absPosToMsg.get(i).y >= pos) {
pane.setToolTipText(msges.get(i));
//errorPopupMenu.getErrorItem().setText(msges.get(i));
//errorPopupMenu.show(pane, e.getX(), e.getY() + 20);
return;
}
}
pane.setToolTipText(null);
/*if(errorPopupMenu.isVisible()) {
errorPopupMenu.setVisible(false);
}*/
}
示例7: mouseMoved
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseMoved(MouseEvent e) {
mouseX = e.getX();
mouseY = e.getY();
MouseMovedEvent event = new MouseMovedEvent(e.getX(), e.getY());
try {
eventListener.onEvent(event);
} catch (Exception ex) {}
}
示例8: mousePressed
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)) {
setOffsetMarker(e);
drag = false;
click.x = e.getX();
click.y = e.getY();
} else if (SwingUtilities.isRightMouseButton(e) && rcDisArm) {
hideCropper();
}
}
示例9: update
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
* Updates this drag context for the specified mouse event. Updates the
* current mouse event and the current point's local, world, and pixel
* coordinates. Mouse motion listeners call this method as the mouse is
* dragged.
* @param event the mouse event.
*/
public void update(MouseEvent event) {
_event = event;
_pointPixel.x = event.getX();
_pointPixel.y = event.getY();
_pointLocal = _pixelToLocal.times(_pointPixel);
_pointWorld = _pixelToWorld.times(_pointPixel);
}
示例10: mouseDragged
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseDragged(MouseEvent e)
{
int x = e.getX();
int y = e.getY();
int button = e.getButton();
l.mouseDragged(x, y, button);
}
示例11: mouseMoved
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
* Implementation of the MouseMotionListener's method.
*
* @param e the event.
*/
public void mouseMoved(MouseEvent e) {
Graphics2D g2 = (Graphics2D) getGraphics();
if (this.horizontalAxisTrace) {
drawHorizontalAxisTrace(g2, e.getX());
}
if (this.verticalAxisTrace) {
drawVerticalAxisTrace(g2, e.getY());
}
g2.dispose();
Object[] listeners = this.chartMouseListeners.getListeners(
ChartMouseListener.class);
if (listeners.length == 0) {
return;
}
Insets insets = getInsets();
int x = (int) ((e.getX() - insets.left) / this.scaleX);
int y = (int) ((e.getY() - insets.top) / this.scaleY);
ChartEntity entity = null;
if (this.info != null) {
EntityCollection entities = this.info.getEntityCollection();
if (entities != null) {
entity = entities.getEntity(x, y);
}
}
// we can only generate events if the panel's chart is not null
// (see bug report 1556951)
if (this.chart != null) {
ChartMouseEvent event = new ChartMouseEvent(getChart(), e, entity);
for (int i = listeners.length - 1; i >= 0; i -= 1) {
((ChartMouseListener) listeners[i]).chartMouseMoved(event);
}
}
}
示例12: mouseDragged
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseDragged(MouseEvent e) {
if ((e.getX() - UpperLeftGraph.x) >= 0 && (e.getY() - UpperLeftGraph.y) >= 0
&& (e.getX() - UpperLeftGraph.x) < FuzzyKSingleClusterScatter.this.WIDTH
&& (e.getY() - UpperLeftGraph.y) < FuzzyKSingleClusterScatter.this.HEIGHT && zoomming) {
xEnd = e.getX();
yEnd = e.getY();
p.repaint();
}
}
示例13: mouseMoved
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseMoved(MouseEvent arg0) {
game.screenMousePos.x = arg0.getX();
game.screenMousePos.y = arg0.getY();
}
示例14: mouseReleased
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseReleased(InstanceState state, MouseEvent e) {
pinValues obj = (pinValues) state.getData();
Location loc = state.getInstance().getLocation();
int cx = loc.getX();
int cy = loc.getY();
Direction dir = state.getAttributeValue(StdAttr.FACING);
int gx = e.getX();
int gy = e.getY();
int x = gx - cx;
int y = gy - cy;
if ((y < -5 && y > -25) && (dir == Direction.SOUTH)) {
x -= 5;
x = x / 10;
if (x % 2 == 0) {
x = x / 2;
obj.setValue(state, obj.getValue(x).not(), x);// opposite value
}
} else if ((x < -5 && x > -25) && (dir == Direction.EAST)) {
y -= 5;
y = y / 10;
if (y % 2 == 0) {
y = y / 2;
obj.setValue(state, obj.getValue(y).not(), y);// opposite value
}
} else if ((y > 5 && y < 25) && (dir == Direction.NORTH)) {
x -= 5;
x = x / 10;
if (x % 2 == 0) {
x = x / 2;
obj.setValue(state, obj.getValue(x).not(), x);// opposite value
}
} else if ((x > 5 && x < 25) && (dir == Direction.WEST)) {
y -= 5;
y /= 10;
if (y % 2 == 0) {
y /= 2;
obj.setValue(state, obj.getValue(y).not(), y);// opposite value
}
}
}
示例15: mouseReleased
import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseReleased(MouseEvent e) {
int xPos = e.getX();
int yPos = e.getY();
checkMousePos(xPos, yPos);
}