/** * Returns the tool tip to display for a mouse event at the given * location. This method is overridden to give a registered parser a * chance to display a tool tip (such as an error description when the * mouse is over an error highlight). * * @param e The mouse event. */ @Override public String getToolTipText(MouseEvent e) { // Apple JVMS (Java 6 and prior) have their ToolTipManager events // repeat for some reason, so this method gets called every 1 second // or so. We short-circuit that since some ToolTipManagers may do // expensive calculations (e.g. language supports). if (RSyntaxUtilities.getOS()==RSyntaxUtilities.OS_MAC_OSX) { Point newLoc = e.getPoint(); if (newLoc!=null && newLoc.equals(cachedTipLoc)) { return cachedTip; } cachedTipLoc = newLoc; } return cachedTip = getToolTipTextImpl(e); }
/** * Tests if param has explicit destination. * * @param pParam the image read parameter, or {@code null} * @return true if {@code pParam} is non-{@code null} and either its {@code getDestination}, * {@code getDestinationType} returns a non-{@code null} value, * or {@code getDestinationOffset} returns a {@link Point} that is not the upper left corner {@code (0, 0)}. */ protected static boolean hasExplicitDestination(final ImageReadParam pParam) { return pParam != null && ( pParam.getDestination() != null || pParam.getDestinationType() != null || !ORIGIN.equals(pParam.getDestinationOffset()) ); }
/** * Respond to a mouse dragged event. Calls {@link org.geotools.swing.MapPane#moveImage()} * * @param ev the mouse event */ @Override public void onMouseDragged(MapMouseEvent ev) { if (panning) { Point pos = ev.getPoint(); if (!pos.equals(panePos)) { ((JMapPane) getMapPane()).moveImage(pos.x - panePos.x, pos.y - panePos.y); panePos = pos; } } }
/** * If the mouse was dragged, determines the bounds of the box that the user defined and passes * this to the mapPane's {@code setDisplayArea} method. * * @param ev the mouse event */ @Override public void onMouseReleased(MapMouseEvent ev) { if (dragged && !ev.getPoint().equals(startPosDevice)) { Envelope2D env = new Envelope2D(); env.setFrameFromDiagonal(startPosWorld, ev.getWorldPos()); dragged = false; getMapPane().setDisplayArea(env); } }
public void setLocation(Point location) { boolean reachedDestination; synchronized (this) { this.location = location; reachedDestination = location.equals(destination); } if (reachedDestination) dispatcher.notifyAvailable(this); }
static boolean isLegalMove(Point from, Point to) { boolean legal = false; for (Point p : getNeighbours(from)) { if (p.equals(to)) { legal = true; break; } } return legal; }
/** Returns whether the given object is an equivalent * <code>ComponentLocation</code>. */ public boolean equals(Object o) { if (o instanceof ComponentLocation) { ComponentLocation loc = (ComponentLocation)o; return (where == null && loc.where == null) || (where != null && where.equals(loc.where)); } return false; }
if (!newPt.equals(p)) {
private boolean isGameOver(int headLocX, int headLocY) { for (int i = SNAKE_LENGTH_DEFAULT; i < totalBodyPart - 2; i++) { Point partLoc = snakeBodyPart[i].getLocation(); if (partLoc.equals(new Point(headLocX, headLocY))) { Testing test = new Testing(score);//This is the correct way to initialize the Testing class. return true; } }
private boolean isLocationUsed(Point location) { for (UserInfo dialog : dialogs) { if (dialog.getLocation().equals(location)) { return true; } } return false; }
/** * @param point the new point */ public void setPoint(Point point) { if (!this.point.equals(point)) { this.point = point; fireStateChanged(); } }
public void setLocation(int x, int y) { Point newLocation = new Point(x, y); if (location != null && location.equals(newLocation)) return; Point old = this.location; this.location = newLocation; firePropertyChangeEvent("location", old, location); }
private boolean isGameOver(int headLocX, int headLocY) { for (int i = SNAKE_LENGTH_DEFAULT; i < totalBodyPart - 2; i++) { Point partLoc = snakeBodyPart[i].getLocation(); if (partLoc.equals(new Point(headLocX, headLocY))) { Testing test = new Testing(); Testing(score);//It is an invalid call no method is defined like this or a class can't be initialized like this. return true; } }
public void mouseMoved(MouseEvent e) { // Do not display popup when a modifier is pressed (can't read all keys) if (e.getModifiers() != 0) return; Point point = e.getPoint(); // Skip AWT noise after closing popup if (point.equals(forwardPoint)) return; checkPopup(table.rowAtPoint(point), table.columnAtPoint(point), point); } }
protected void updateAutoscroll(Point dragCursorLocn) { if (this.lastDragCursorLocn.equals(dragCursorLocn)) return; else this.lastDragCursorLocn.setLocation(dragCursorLocn); this.doAutoscroll(dragCursorLocn); }
public void mouseMoved(int x, int y, MouseEvent event) { if (myLastMotionReport != null && myLastMotionReport.equals(new Point(x, y))) { return; } if (shouldSendMouseData(MouseMode.MOUSE_REPORTING_ALL_MOTION)) { if (myTerminalOutput != null) { myTerminalOutput.sendBytes(mouseReport(MouseButtonCodes.RELEASE, x + 1, y + 1)); } } myLastMotionReport = new Point(x, y); }
private Alignment getAlign (Point target) { for (Entry<Alignment, Point> entry : points.entrySet()) { if (entry.getValue().equals(target)) { return entry.getKey(); } } return null; } }
public void setLocation(int x, int y) { Point old = internalFrame.getLocation(); Point location = new Point(x, y); if (old.equals(location)) return; internalFrame.setLocation(location); firePropertyChangeEvent("location", old, location); }
public void update() { if (popup != null) { Point newPos = determinePosition(); if (newPos == null) { hide(); } else if (!newPos.equals(position)) { hide(); showNow(); } } }