private boolean isInArrowArea( Point p ) { return p.getLocation().x >= getWidth() - IconWithArrow.getArrowAreaWidth() - getInsets().right; }
private boolean isInArrowArea( Point p ) { return p.getLocation().x >= getWidth() - IconWithArrow.getArrowAreaWidth() - getInsets().right; }
private void updatePreferredSize(int n, Point p) { double d = (double) n * 1.08; d = (n > 0) ? 1 / d : -d; int w = (int) (getWidth() * d); int h = (int) (getHeight() * d); preferredSize.setSize(w, h); // Question: how do I keep 'p' centered in the resulting view? int parentWdt = this.getParent( ).getWidth( ) ; int parentHgt = this.getParent( ).getHeight( ) ; int newLeft = p.getLocation( ).x - ( p.x - ( parentWdt / 2 ) ) ; int newTop = p.getLocation( ).y - ( p.y - ( parentHgt / 2 ) ) ; this.setLocation( newLeft, newTop ) ; getParent().doLayout(); }
Point getAbstractLocation() { //we can't do aLoc=loc because then we can mutate aLoc by mutating loc return aLoc.getLocation(); }
//Fixed version! public MyClass(Point foo, Point bar) { this.foo = new Point(foo.getLocation()); this.bar = new Point(bar.getLocation()); } public Point foo() { return new Point(foo.getLocation()); } public Point bar() { return new Point(bar.getLocation()); } . . .
import java.awt.Point; import java.awt.Rectangle; import java.awt.Dimension; class PointDemo { public static void main(String[] args) { Point originOne = new Point(25,50); Rectangle R1 = new Rectangle(originOne, new Dimension(100, 200)); // No error System.out.println("OriginOne X = " + originOne.getLocation()); } }
private boolean isInArrowArea(Point p) { return p.getLocation().x >= getWidth() - 3 - 2 - getInsets().right; }
protected void updateCanClickState(JXLayer<JComponent> l, MouseEvent e) { // udpate toolTipText Point layerLocation = l.getView().getLocation(); Point mousePoint = e.getPoint(); BufferedImage currentIcon = getCurrentIcon(); if (currentIcon == null) { setCanClick(false); return; } int minX = (int) layerLocation.getX() + l.getWidth() - currentIcon.getWidth(); int maxX = (int) layerLocation.getX() + l.getWidth(); int minY = 0; int maxY = currentIcon.getHeight(); boolean accept = minX <= mousePoint.getX() && mousePoint.getX() <= maxX; accept &= minY <= mousePoint.getLocation().getY() && mousePoint.getLocation().getY() <= maxY; setCanClick(accept); } }
protected void updateCanClickState(JXLayer<JComponent> l, MouseEvent e) { // udpate toolTipText Point layerLocation = l.getView().getLocation(); Point mousePoint = e.getPoint(); BufferedImage currentIcon = getCurrentIcon(); if (currentIcon == null) { setCanClick(false); return; } int minX = (int) layerLocation.getX() + l.getWidth() - currentIcon.getWidth(); int maxX = (int) layerLocation.getX() + l.getWidth(); int minY = 0; int maxY = currentIcon.getHeight(); boolean accept = minX <= mousePoint.getX() && mousePoint.getX() <= maxX; accept &= minY <= mousePoint.getLocation().getY() && mousePoint.getLocation().getY() <= maxY; setCanClick(accept); } }
private boolean isInArrowArea(Point p) { return p.getLocation().x >= getWidth() - 3 - 2 - getInsets().right; }
protected void updateCanClickState(JXLayer<? extends JComponent> l, MouseEvent e) { // udpate toolTipText Point layerLocation = l.getView().getLocation(); Point mousePoint = e.getPoint(); BufferedImage currentIcon = getCurrentIcon(); if (currentIcon == null) { setCanClick(false); return; } int minX = (int) layerLocation.getX() + l.getWidth() - currentIcon.getWidth(); int maxX = (int) layerLocation.getX() + l.getWidth(); int minY = 0; int maxY = currentIcon.getHeight(); boolean accept = minX <= mousePoint.getX() && mousePoint.getX() <= maxX; accept &= minY <= mousePoint.getLocation().getY() && mousePoint.getLocation().getY() <= maxY; setCanClick(accept); } }
protected void updateCanClickState(JXLayer<JComponent> l, MouseEvent e) { // udpate toolTipText Point layerLocation = l.getView().getLocation(); Point mousePoint = e.getPoint(); BufferedImage currentIcon = getCurrentIcon(); if (currentIcon == null) { setCanClick(false); return; } int minX = (int) layerLocation.getX() + l.getWidth() - currentIcon.getWidth(); int maxX = (int) layerLocation.getX() + l.getWidth(); int minY = 0; int maxY = currentIcon.getHeight(); boolean accept = minX <= mousePoint.getX() && mousePoint.getX() <= maxX; accept &= minY <= mousePoint.getLocation().getY() && mousePoint.getLocation().getY() <= maxY; setCanClick(accept); } }
protected void updateCanClickState(JXLayer<JComponent> l, MouseEvent e) { // udpate toolTipText Point layerLocation = l.getView().getLocation(); Point mousePoint = e.getPoint(); BufferedImage currentIcon = getCurrentIcon(); if (currentIcon == null) { setCanClick(false); return; } int minX = (int) layerLocation.getX() + l.getWidth() - currentIcon.getWidth(); int maxX = (int) layerLocation.getX() + l.getWidth(); int minY = 0; int maxY = currentIcon.getHeight(); boolean accept = minX <= mousePoint.getX() && mousePoint.getX() <= maxX; accept &= minY <= mousePoint.getLocation().getY() && mousePoint.getLocation().getY() <= maxY; setCanClick(accept); } }
protected void updateCanClickState(JXLayer<? extends JComponent> l, MouseEvent e) { // udpate toolTipText Point layerLocation = l.getView().getLocation(); Point mousePoint = e.getPoint(); BufferedImage currentIcon = getCurrentIcon(); if (currentIcon == null) { setCanClick(false); return; } int minX = (int) layerLocation.getX() + l.getWidth() - currentIcon.getWidth(); int maxX = (int) layerLocation.getX() + l.getWidth(); int minY = 0; int maxY = currentIcon.getHeight(); boolean accept = minX <= mousePoint.getX() && mousePoint.getX() <= maxX; accept &= minY <= mousePoint.getLocation().getY() && mousePoint.getLocation().getY() <= maxY; setCanClick(accept); } }
private boolean isInArrowArea(Point p) { return p.getLocation().x >= getWidth() - IconWithArrow.getArrowAreaWidth() - getInsets().right; }
private boolean isInArrowArea(Point p) { return p.getLocation().x >= getWidth() - IconWithArrow.getArrowAreaWidth() - getInsets().right; }
tempy = Integer.parseInt(tempString); this.coordinates.setLocation(tempx, tempy);// set input data into this.coordinateList.add(this.coordinates.getLocation()); // put in
public AcquireImageValues(AcquireImageValues object) { setCropZone(Optional.ofNullable(object.cropZone).map(r -> r.getBounds()).orElse(null)); setLayerOffset(Optional.ofNullable(object.layerOffset).map(p -> p.getLocation()).orElse(null)); setOrientation(object.orientation); setRotation(object.rotation); setBrightness(object.brightness); setContrast(object.contrast); setAutoLevel(object.autoLevel); setFlip(object.flip); setCalibrationUnit(object.calibrationUnit); setCalibrationRatio(object.calibrationRatio); setRatio(object.ratio); }
p2.setLocation(e.getPoint()); lines.add(new Line2D.Double(p1, p2)); p2.setLocation(p1.getLocation());
p2.setLocation(e.getPoint()); lines.add(new Line2D.Double(p1, p2)); p2.setLocation(p1.getLocation());