Java Code Examples for java.awt.geom.Rectangle2D#equals()
The following examples show how to use
java.awt.geom.Rectangle2D#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleImageTranscoder.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public void setCanvasAreaOfInterest(final Rectangle2D value) { if (value == null) { if (canvasAOI == null) { return; } canvasAOI = null; contentChanged(); return; } if (value.equals(canvasAOI)) { return; } canvasAOI = new Rectangle2D.Float(); canvasAOI.setRect(value); contentChanged(); }
Example 2
Source File: PgramUserBoundsTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) { System.out.println("user bounds = "+userBounds); if (!userBounds.equals(expectedBounds)) { throw new RuntimeException("bounds fail to match"); } return c.createContext(cm, deviceBounds, userBounds, xform, hints); }
Example 3
Source File: RegionSelectableWorldMapPane.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
private void adaptToModelRectangle(Rectangle2D modelRectangle) { correctBoundsIfNecessary(modelRectangle); if (modelRectangle.getWidth() != 0 && modelRectangle.getHeight() != 0 && !modelRectangle.equals(getFirstFigure().getBounds())) { updateFigure(modelRectangle); updateProperties(modelRectangle); } }
Example 4
Source File: MultiThumbSliderUI.java From PyramidShader with GNU General Public License v3.0 | 5 votes |
private boolean isOverlap(int thumbIndexA,int thumbIndexB,float newThumbBPosition) { if(thumbIndexA==thumbIndexB) return false; if(!slider.isThumbOverlap()) { Point2D aCenter = getThumbCenter(positions[thumbIndexA]); Point2D bCenter = getThumbCenter(newThumbBPosition); Rectangle2D aBounds = ShapeBounds.getBounds( getThumbShape(thumbIndexA, aCenter) ); Rectangle2D bBounds = ShapeBounds.getBounds( getThumbShape(thumbIndexB, bCenter) ); return aBounds.intersects(bBounds) || aBounds.equals(bBounds); } return false; }
Example 5
Source File: PgramUserBoundsTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) { System.out.println("user bounds = "+userBounds); if (!userBounds.equals(expectedBounds)) { throw new RuntimeException("bounds fail to match"); } return c.createContext(cm, deviceBounds, userBounds, xform, hints); }
Example 6
Source File: PgramUserBoundsTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) { System.out.println("user bounds = "+userBounds); if (!userBounds.equals(expectedBounds)) { throw new RuntimeException("bounds fail to match"); } return c.createContext(cm, deviceBounds, userBounds, xform, hints); }
Example 7
Source File: AbstractBox.java From jclic with GNU General Public License v2.0 | 5 votes |
public void setBounds(Rectangle2D r) { if (r.equals((Rectangle2D) this)) return; if (specialShape) { AffineTransform tx = null; if (getWidth() != r.getWidth() || getHeight() != r.getHeight()) { tx = AffineTransform.getTranslateInstance(-getX(), -getY()); shape = tx.createTransformedShape(shape); tx = AffineTransform.getScaleInstance(r.getWidth() / getWidth(), r.getHeight() / getHeight()); shape = tx.createTransformedShape(shape); tx = AffineTransform.getTranslateInstance(getX(), getY()); shape = tx.createTransformedShape(shape); } if (getX() != r.getX() || getY() != r.getY()) { tx = AffineTransform.getTranslateInstance(r.getX() - getX(), r.getY() - getY()); shape = tx.createTransformedShape(shape); } if (tx != null) { setShape(shape); } } else { repaint(); setRect(r); repaint(); } setHostedComponentBounds(); }
Example 8
Source File: PrintLayout.java From pumpernickel with MIT License | 5 votes |
/** * This adjusts the imageable bounds of the paper. It is not recommended * that you use this method directly. The methods that set the insets, paper * width, paper height, and orientation automatically adjust this property * for you to fit your needs. * * @param r * the new imageable bounds. * @return <code>true</code> if a change occurred. */ public boolean setPaperImageableBounds(Rectangle2D r) { Rectangle2D oldBounds = getPaperImageableBounds(); if (r.equals(oldBounds)) return false; Paper paper = pageFormat.getPaper(); paper.setImageableArea(r.getX(), r.getY(), r.getWidth(), r.getHeight()); pageFormat.setPaper(paper); firePropertyChange(PROPERTY_IMAGEABLE_BOUNDS, oldBounds, r.clone()); return true; }
Example 9
Source File: PgramUserBoundsTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) { System.out.println("user bounds = "+userBounds); if (!userBounds.equals(expectedBounds)) { throw new RuntimeException("bounds fail to match"); } return c.createContext(cm, deviceBounds, userBounds, xform, hints); }
Example 10
Source File: PgramUserBoundsTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) { System.out.println("user bounds = "+userBounds); if (!userBounds.equals(expectedBounds)) { throw new RuntimeException("bounds fail to match"); } return c.createContext(cm, deviceBounds, userBounds, xform, hints); }
Example 11
Source File: PgramUserBoundsTest.java From hottub with GNU General Public License v2.0 | 5 votes |
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) { System.out.println("user bounds = "+userBounds); if (!userBounds.equals(expectedBounds)) { throw new RuntimeException("bounds fail to match"); } return c.createContext(cm, deviceBounds, userBounds, xform, hints); }
Example 12
Source File: PgramUserBoundsTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) { System.out.println("user bounds = "+userBounds); if (!userBounds.equals(expectedBounds)) { throw new RuntimeException("bounds fail to match"); } return c.createContext(cm, deviceBounds, userBounds, xform, hints); }
Example 13
Source File: PgramUserBoundsTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) { System.out.println("user bounds = "+userBounds); if (!userBounds.equals(expectedBounds)) { throw new RuntimeException("bounds fail to match"); } return c.createContext(cm, deviceBounds, userBounds, xform, hints); }
Example 14
Source File: PgramUserBoundsTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) { System.out.println("user bounds = "+userBounds); if (!userBounds.equals(expectedBounds)) { throw new RuntimeException("bounds fail to match"); } return c.createContext(cm, deviceBounds, userBounds, xform, hints); }
Example 15
Source File: PgramUserBoundsTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) { System.out.println("user bounds = "+userBounds); if (!userBounds.equals(expectedBounds)) { throw new RuntimeException("bounds fail to match"); } return c.createContext(cm, deviceBounds, userBounds, xform, hints); }
Example 16
Source File: PgramUserBoundsTest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) { System.out.println("user bounds = "+userBounds); if (!userBounds.equals(expectedBounds)) { throw new RuntimeException("bounds fail to match"); } return c.createContext(cm, deviceBounds, userBounds, xform, hints); }
Example 17
Source File: PgramUserBoundsTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) { System.out.println("user bounds = "+userBounds); if (!userBounds.equals(expectedBounds)) { throw new RuntimeException("bounds fail to match"); } return c.createContext(cm, deviceBounds, userBounds, xform, hints); }
Example 18
Source File: StyledFontLayoutTest.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private static void runTest() { im = new BufferedImage(W, H, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = im.createGraphics(); g2d.setColor(Color.white); g2d.fillRect(0, 0, W, H); g2d.setColor(Color.black); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); char[] chs = "Sample Text.".toCharArray(); int len = chs.length; int x = 50, y = 100; FontRenderContext frc = g2d.getFontRenderContext(); Font plain = new Font("Serif", Font.PLAIN, 48); GlyphVector pgv = plain.layoutGlyphVector(frc, chs, 0, len, 0); g2d.setFont(plain); g2d.drawChars(chs, 0, len, x, y); y +=50; g2d.drawGlyphVector(pgv, x, y); y += 50; Rectangle2D plainStrBounds = plain.getStringBounds(chs, 0, len, frc); Rectangle2D plainGVBounds = pgv.getLogicalBounds(); Font bold = new Font("Serif", Font.BOLD, 48); GlyphVector bgv = bold.layoutGlyphVector(frc, chs, 0, len, 0); Rectangle2D boldStrBounds = bold.getStringBounds(chs, 0, len, frc); Rectangle2D boldGVBounds = bgv.getLogicalBounds(); g2d.setFont(bold); g2d.drawChars(chs, 0, len, x, y); y +=50; g2d.drawGlyphVector(bgv, x, y); System.out.println("Plain String Bounds = " + plainStrBounds); System.out.println("Bold String Bounds = " + boldStrBounds); System.out.println("Plain GlyphVector Bounds = " + plainGVBounds); System.out.println("Bold GlyphVector Bounds = " + boldGVBounds); if (!plainStrBounds.equals(boldStrBounds) && plainGVBounds.equals(boldGVBounds)) { System.out.println("Test failed: Plain GV bounds same as Bold"); if (!interactive) { throw new RuntimeException("Plain GV bounds same as Bold"); } } }
Example 19
Source File: StyledFontLayoutTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private static void runTest() { im = new BufferedImage(W, H, BufferedImage.TYPE_INT_RGB); Graphics2D g2d = im.createGraphics(); g2d.setColor(Color.white); g2d.fillRect(0, 0, W, H); g2d.setColor(Color.black); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); char[] chs = "Sample Text.".toCharArray(); int len = chs.length; int x = 50, y = 100; FontRenderContext frc = g2d.getFontRenderContext(); Font plain = new Font("Serif", Font.PLAIN, 48); GlyphVector pgv = plain.layoutGlyphVector(frc, chs, 0, len, 0); g2d.setFont(plain); g2d.drawChars(chs, 0, len, x, y); y +=50; g2d.drawGlyphVector(pgv, x, y); y += 50; Rectangle2D plainStrBounds = plain.getStringBounds(chs, 0, len, frc); Rectangle2D plainGVBounds = pgv.getLogicalBounds(); Font bold = new Font("Serif", Font.BOLD, 48); GlyphVector bgv = bold.layoutGlyphVector(frc, chs, 0, len, 0); Rectangle2D boldStrBounds = bold.getStringBounds(chs, 0, len, frc); Rectangle2D boldGVBounds = bgv.getLogicalBounds(); g2d.setFont(bold); g2d.drawChars(chs, 0, len, x, y); y +=50; g2d.drawGlyphVector(bgv, x, y); System.out.println("Plain String Bounds = " + plainStrBounds); System.out.println("Bold String Bounds = " + boldStrBounds); System.out.println("Plain GlyphVector Bounds = " + plainGVBounds); System.out.println("Bold GlyphVector Bounds = " + boldGVBounds); if (!plainStrBounds.equals(boldStrBounds) && plainGVBounds.equals(boldGVBounds)) { System.out.println("Test failed: Plain GV bounds same as Bold"); if (!interactive) { throw new RuntimeException("Plain GV bounds same as Bold"); } } }
Example 20
Source File: DetachedDockViewAsTab.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void scanDrop(DockEvent event, boolean drop) { if (getParent() instanceof TabbedDockableContainer) { if (drop) { ((DockDropEvent) event).rejectDrop(); } else { ((DockDragEvent) event).delegateDrag(); } return; } if (event.getDragSource().getDockable() == dockable) { if (drop) { ((DockDropEvent) event).rejectDrop(); } else { ((DockDragEvent) event).rejectDrag(); } return; } if (event.getDragSource().getDockableContainer() instanceof TabbedDockableContainer) { if (drop) { ((DockDropEvent) event).rejectDrop(); } else { ((DockDragEvent) event).rejectDrag(); } return; } Rectangle bounds = getBounds(); DockGroup sourceGroup = event.getDragSource().getDockable().getDockKey().getDockGroup(); DockGroup destinationGroup = dockable.getDockKey().getDockGroup(); if (!DockGroup.areGroupsCompatible(destinationGroup, sourceGroup)) { if (drop) { ((DockDropEvent) event).rejectDrop(); } else { ((DockDragEvent) event).rejectDrag(); } return; } Dockable sourceDockable = event.getDragSource().getDockable(); DockableState.Location dockableLocation = sourceDockable.getDockKey().getLocation(); DockableState.Location viewLocation = dockable.getDockKey().getLocation(); if (drop) { event.setDockingAction(new DockingActionCreateTabEvent(event.getDesktop(), sourceDockable, dockableLocation, viewLocation, dockable, 0)); ((DockDropEvent) event).acceptDrop(false); desktop.createTab(dockable, event.getDragSource().getDockable(), 0, true); } else { Rectangle2D r2d = new Rectangle2D.Float(bounds.x, bounds.y, bounds.width, bounds.height); event.setDockingAction(new DockingActionCreateTabEvent(event.getDesktop(), sourceDockable, dockableLocation, viewLocation, dockable, 0)); if (r2d.equals(lastDropShape)) { ((DockDragEvent) event).acceptDrag(lastDropGeneralPath); } else { GeneralPath path = buildPathForTab(bounds); lastDropShape = r2d; lastDropGeneralPath = path; ((DockDragEvent) event).acceptDrag(lastDropGeneralPath); } } }