Java Code Examples for java.awt.geom.Rectangle2D#intersect()
The following examples show how to use
java.awt.geom.Rectangle2D#intersect() .
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: AquaCaret.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Damages the area surrounding the caret to cause * it to be repainted in a new location. If paint() * is reimplemented, this method should also be * reimplemented. This method should update the * caret bounds (x, y, width, and height). * * @param r the current location of the caret * @see #paint */ protected synchronized void damage(final Rectangle r) { if (r == null || fPainting) return; x = r.x - 4; y = r.y; width = 10; height = r.height; // Don't damage the border area. We can't paint a partial border, so get the // intersection of the caret rectangle and the component less the border, if any. final Rectangle caretRect = new Rectangle(x, y, width, height); final Border border = getComponent().getBorder(); if (border != null) { final Rectangle alloc = getComponent().getBounds(); alloc.x = alloc.y = 0; final Insets borderInsets = border.getBorderInsets(getComponent()); alloc.x += borderInsets.left; alloc.y += borderInsets.top; alloc.width -= borderInsets.left + borderInsets.right; alloc.height -= borderInsets.top + borderInsets.bottom; Rectangle2D.intersect(caretRect, alloc, caretRect); } x = caretRect.x; y = caretRect.y; width = Math.max(caretRect.width, 1); height = Math.max(caretRect.height, 1); repaint(); }
Example 2
Source File: AquaCaret.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Damages the area surrounding the caret to cause * it to be repainted in a new location. If paint() * is reimplemented, this method should also be * reimplemented. This method should update the * caret bounds (x, y, width, and height). * * @param r the current location of the caret * @see #paint */ protected synchronized void damage(final Rectangle r) { if (r == null || fPainting) return; x = r.x - 4; y = r.y; width = 10; height = r.height; // Don't damage the border area. We can't paint a partial border, so get the // intersection of the caret rectangle and the component less the border, if any. final Rectangle caretRect = new Rectangle(x, y, width, height); final Border border = getComponent().getBorder(); if (border != null) { final Rectangle alloc = getComponent().getBounds(); alloc.x = alloc.y = 0; final Insets borderInsets = border.getBorderInsets(getComponent()); alloc.x += borderInsets.left; alloc.y += borderInsets.top; alloc.width -= borderInsets.left + borderInsets.right; alloc.height -= borderInsets.top + borderInsets.bottom; Rectangle2D.intersect(caretRect, alloc, caretRect); } x = caretRect.x; y = caretRect.y; width = Math.max(caretRect.width, 1); height = Math.max(caretRect.height, 1); repaint(); }
Example 3
Source File: Rectangle.java From Java8CN with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} * @since 1.2 */ public Rectangle2D createIntersection(Rectangle2D r) { if (r instanceof Rectangle) { return intersection((Rectangle) r); } Rectangle2D dest = new Rectangle2D.Double(); Rectangle2D.intersect(this, r, dest); return dest; }
Example 4
Source File: AquaCaret.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Damages the area surrounding the caret to cause * it to be repainted in a new location. If paint() * is reimplemented, this method should also be * reimplemented. This method should update the * caret bounds (x, y, width, and height). * * @param r the current location of the caret * @see #paint */ protected synchronized void damage(final Rectangle r) { if (r == null || fPainting) return; x = r.x - 4; y = r.y; width = 10; height = r.height; // Don't damage the border area. We can't paint a partial border, so get the // intersection of the caret rectangle and the component less the border, if any. final Rectangle caretRect = new Rectangle(x, y, width, height); final Border border = getComponent().getBorder(); if (border != null) { final Rectangle alloc = getComponent().getBounds(); alloc.x = alloc.y = 0; final Insets borderInsets = border.getBorderInsets(getComponent()); alloc.x += borderInsets.left; alloc.y += borderInsets.top; alloc.width -= borderInsets.left + borderInsets.right; alloc.height -= borderInsets.top + borderInsets.bottom; Rectangle2D.intersect(caretRect, alloc, caretRect); } x = caretRect.x; y = caretRect.y; width = Math.max(caretRect.width, 1); height = Math.max(caretRect.height, 1); repaint(); }
Example 5
Source File: Rectangle.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} * @since 1.2 */ public Rectangle2D createIntersection(Rectangle2D r) { if (r instanceof Rectangle) { return intersection((Rectangle) r); } Rectangle2D dest = new Rectangle2D.Double(); Rectangle2D.intersect(this, r, dest); return dest; }
Example 6
Source File: AquaCaret.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Damages the area surrounding the caret to cause * it to be repainted in a new location. If paint() * is reimplemented, this method should also be * reimplemented. This method should update the * caret bounds (x, y, width, and height). * * @param r the current location of the caret * @see #paint */ @Override protected synchronized void damage(final Rectangle r) { if (r == null || fPainting) return; x = r.x - 4; y = r.y; width = 10; height = r.height; // Don't damage the border area. We can't paint a partial border, so get the // intersection of the caret rectangle and the component less the border, if any. final Rectangle caretRect = new Rectangle(x, y, width, height); final Border border = getComponent().getBorder(); if (border != null) { final Rectangle alloc = getComponent().getBounds(); alloc.x = alloc.y = 0; final Insets borderInsets = border.getBorderInsets(getComponent()); alloc.x += borderInsets.left; alloc.y += borderInsets.top; alloc.width -= borderInsets.left + borderInsets.right; alloc.height -= borderInsets.top + borderInsets.bottom; Rectangle2D.intersect(caretRect, alloc, caretRect); } x = caretRect.x; y = caretRect.y; width = Math.max(caretRect.width, 1); height = Math.max(caretRect.height, 1); repaint(); }
Example 7
Source File: AquaCaret.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Damages the area surrounding the caret to cause * it to be repainted in a new location. If paint() * is reimplemented, this method should also be * reimplemented. This method should update the * caret bounds (x, y, width, and height). * * @param r the current location of the caret * @see #paint */ protected synchronized void damage(final Rectangle r) { if (r == null || fPainting) return; x = r.x - 4; y = r.y; width = 10; height = r.height; // Don't damage the border area. We can't paint a partial border, so get the // intersection of the caret rectangle and the component less the border, if any. final Rectangle caretRect = new Rectangle(x, y, width, height); final Border border = getComponent().getBorder(); if (border != null) { final Rectangle alloc = getComponent().getBounds(); alloc.x = alloc.y = 0; final Insets borderInsets = border.getBorderInsets(getComponent()); alloc.x += borderInsets.left; alloc.y += borderInsets.top; alloc.width -= borderInsets.left + borderInsets.right; alloc.height -= borderInsets.top + borderInsets.bottom; Rectangle2D.intersect(caretRect, alloc, caretRect); } x = caretRect.x; y = caretRect.y; width = Math.max(caretRect.width, 1); height = Math.max(caretRect.height, 1); repaint(); }
Example 8
Source File: Rectangle.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} * @since 1.2 */ public Rectangle2D createIntersection(Rectangle2D r) { if (r instanceof Rectangle) { return intersection((Rectangle) r); } Rectangle2D dest = new Rectangle2D.Double(); Rectangle2D.intersect(this, r, dest); return dest; }
Example 9
Source File: Rectangle.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} * @since 1.2 */ public Rectangle2D createIntersection(Rectangle2D r) { if (r instanceof Rectangle) { return intersection((Rectangle) r); } Rectangle2D dest = new Rectangle2D.Double(); Rectangle2D.intersect(this, r, dest); return dest; }
Example 10
Source File: Rectangle.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} * @since 1.2 */ public Rectangle2D createIntersection(Rectangle2D r) { if (r instanceof Rectangle) { return intersection((Rectangle) r); } Rectangle2D dest = new Rectangle2D.Double(); Rectangle2D.intersect(this, r, dest); return dest; }
Example 11
Source File: Rectangle.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} * @since 1.2 */ public Rectangle2D createIntersection(Rectangle2D r) { if (r instanceof Rectangle) { return intersection((Rectangle) r); } Rectangle2D dest = new Rectangle2D.Double(); Rectangle2D.intersect(this, r, dest); return dest; }
Example 12
Source File: Rectangle.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} * @since 1.2 */ public Rectangle2D createIntersection(Rectangle2D r) { if (r instanceof Rectangle) { return intersection((Rectangle) r); } Rectangle2D dest = new Rectangle2D.Double(); Rectangle2D.intersect(this, r, dest); return dest; }
Example 13
Source File: Rectangle.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} * @since 1.2 */ public Rectangle2D createIntersection(Rectangle2D r) { if (r instanceof Rectangle) { return intersection((Rectangle) r); } Rectangle2D dest = new Rectangle2D.Double(); Rectangle2D.intersect(this, r, dest); return dest; }
Example 14
Source File: Rectangle.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * {@inheritDoc} * @since 1.2 */ public Rectangle2D createIntersection(Rectangle2D r) { if (r instanceof Rectangle) { return intersection((Rectangle) r); } Rectangle2D dest = new Rectangle2D.Double(); Rectangle2D.intersect(this, r, dest); return dest; }
Example 15
Source File: Rectangle.java From openchemlib-js with BSD 3-Clause "New" or "Revised" License | 5 votes |
public Rectangle2D createIntersection(Rectangle2D r) { if (r instanceof Rectangle) { return intersection((Rectangle) r); } Rectangle2D dest = new Rectangle2D.Double(); Rectangle2D.intersect(this, r, dest); return dest; }
Example 16
Source File: Rectangle.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} * @since 1.2 */ public Rectangle2D createIntersection(Rectangle2D r) { if (r instanceof Rectangle) { return intersection((Rectangle) r); } Rectangle2D dest = new Rectangle2D.Double(); Rectangle2D.intersect(this, r, dest); return dest; }
Example 17
Source File: AquaCaret.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Damages the area surrounding the caret to cause * it to be repainted in a new location. If paint() * is reimplemented, this method should also be * reimplemented. This method should update the * caret bounds (x, y, width, and height). * * @param r the current location of the caret * @see #paint */ protected synchronized void damage(final Rectangle r) { if (r == null || fPainting) return; x = r.x - 4; y = r.y; width = 10; height = r.height; // Don't damage the border area. We can't paint a partial border, so get the // intersection of the caret rectangle and the component less the border, if any. final Rectangle caretRect = new Rectangle(x, y, width, height); final Border border = getComponent().getBorder(); if (border != null) { final Rectangle alloc = getComponent().getBounds(); alloc.x = alloc.y = 0; final Insets borderInsets = border.getBorderInsets(getComponent()); alloc.x += borderInsets.left; alloc.y += borderInsets.top; alloc.width -= borderInsets.left + borderInsets.right; alloc.height -= borderInsets.top + borderInsets.bottom; Rectangle2D.intersect(caretRect, alloc, caretRect); } x = caretRect.x; y = caretRect.y; width = Math.max(caretRect.width, 1); height = Math.max(caretRect.height, 1); repaint(); }
Example 18
Source File: AquaCaret.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Damages the area surrounding the caret to cause * it to be repainted in a new location. If paint() * is reimplemented, this method should also be * reimplemented. This method should update the * caret bounds (x, y, width, and height). * * @param r the current location of the caret * @see #paint */ protected synchronized void damage(final Rectangle r) { if (r == null || fPainting) return; x = r.x - 4; y = r.y; width = 10; height = r.height; // Don't damage the border area. We can't paint a partial border, so get the // intersection of the caret rectangle and the component less the border, if any. final Rectangle caretRect = new Rectangle(x, y, width, height); final Border border = getComponent().getBorder(); if (border != null) { final Rectangle alloc = getComponent().getBounds(); alloc.x = alloc.y = 0; final Insets borderInsets = border.getBorderInsets(getComponent()); alloc.x += borderInsets.left; alloc.y += borderInsets.top; alloc.width -= borderInsets.left + borderInsets.right; alloc.height -= borderInsets.top + borderInsets.bottom; Rectangle2D.intersect(caretRect, alloc, caretRect); } x = caretRect.x; y = caretRect.y; width = Math.max(caretRect.width, 1); height = Math.max(caretRect.height, 1); repaint(); }
Example 19
Source File: Rectangle.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} * @since 1.2 */ public Rectangle2D createIntersection(Rectangle2D r) { if (r instanceof Rectangle) { return intersection((Rectangle) r); } Rectangle2D dest = new Rectangle2D.Double(); Rectangle2D.intersect(this, r, dest); return dest; }
Example 20
Source File: Rectangle.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} * @since 1.2 */ public Rectangle2D createIntersection(Rectangle2D r) { if (r instanceof Rectangle) { return intersection((Rectangle) r); } Rectangle2D dest = new Rectangle2D.Double(); Rectangle2D.intersect(this, r, dest); return dest; }