Java Code Examples for java.awt.Polygon#getBounds()
The following examples show how to use
java.awt.Polygon#getBounds() .
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: PolygonGrabber.java From triplea with GNU General Public License v3.0 | 6 votes |
private boolean doesPolygonContainAnyBlackInside( final Polygon poly, final BufferedImage imageCopy, final Graphics imageCopyGraphics) { // we would like to just test if each point is both black and contained within the polygon, // but contains counts // the borders, so we have to turn the border edges a different color (then later back to // black again) using a // copy of the image imageCopyGraphics.setColor(Color.GREEN); imageCopyGraphics.drawPolygon(poly.xpoints, poly.ypoints, poly.npoints); final Rectangle rect = poly.getBounds(); for (int x = rect.x; x < rect.x + rect.width; x++) { for (int y = rect.y; y < rect.y + rect.height; y++) { if (isBlack(x, y, imageCopy) && poly.contains(new Point(x, y))) { imageCopyGraphics.setColor(Color.BLACK); imageCopyGraphics.drawPolygon(poly.xpoints, poly.ypoints, poly.npoints); return true; } } } imageCopyGraphics.setColor(Color.BLACK); imageCopyGraphics.drawPolygon(poly.xpoints, poly.ypoints, poly.npoints); return false; }
Example 2
Source File: CSSBorder.java From Java8CN with Apache License 2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 2, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = ((side + 1) % 4 < 2) == (type == Value.GROOVE) ? new Color[] { getShadowColor(color), getLightColor(color) } : new Color[] { getLightColor(color), getShadowColor(color) }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
Example 3
Source File: NimbusEditorTabCellRenderer.java From netbeans with Apache License 2.0 | 5 votes |
public void paintInterior(Graphics g, Component c) { NimbusEditorTabCellRenderer ren = (NimbusEditorTabCellRenderer) c; Polygon p = getInteriorPolygon(c); Rectangle bounds = p.getBounds(); int yDiff = getHeightDifference(ren); paintTabBackground(g, 0, c, bounds.x, bounds.y + yDiff, bounds.width, bounds.height - yDiff); if (!supportsCloseButton((JComponent)c)) { return; } paintCloseButton( g, (JComponent)c ); }
Example 4
Source File: CSSBorder.java From Java8CN with Apache License 2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 3, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = { color, null }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
Example 5
Source File: CSSBorder.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = r.height * factor; int[] lengthPattern = { length, length }; Color[] colorPattern = { color, null }; paintStrokes(r, g, View.X_AXIS, lengthPattern, colorPattern); }
Example 6
Source File: CSSBorder.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 3, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = { color, null }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
Example 7
Source File: CSSBorder.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 2, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = ((side + 1) % 4 < 2) == (type == Value.GROOVE) ? new Color[] { getShadowColor(color), getLightColor(color) } : new Color[] { getLightColor(color), getShadowColor(color) }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
Example 8
Source File: CSSBorder.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 3, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = { color, null }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
Example 9
Source File: CSSBorder.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 2, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = ((side + 1) % 4 < 2) == (type == Value.GROOVE) ? new Color[] { getShadowColor(color), getLightColor(color) } : new Color[] { getLightColor(color), getShadowColor(color) }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
Example 10
Source File: CSSBorder.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 2, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = ((side + 1) % 4 < 2) == (type == Value.GROOVE) ? new Color[] { getShadowColor(color), getLightColor(color) } : new Color[] { getLightColor(color), getShadowColor(color) }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
Example 11
Source File: CSSBorder.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 3, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = { color, null }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
Example 12
Source File: CSSBorder.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = r.height * factor; int[] lengthPattern = { length, length }; Color[] colorPattern = { color, null }; paintStrokes(r, g, View.X_AXIS, lengthPattern, colorPattern); }
Example 13
Source File: CSSBorder.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 2, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = ((side + 1) % 4 < 2) == (type == Value.GROOVE) ? new Color[] { getShadowColor(color), getLightColor(color) } : new Color[] { getLightColor(color), getShadowColor(color) }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
Example 14
Source File: CSSBorder.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = r.height * factor; int[] lengthPattern = { length, length }; Color[] colorPattern = { color, null }; paintStrokes(r, g, View.X_AXIS, lengthPattern, colorPattern); }
Example 15
Source File: CSSBorder.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 3, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = { color, null }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
Example 16
Source File: CSSBorder.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 2, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = ((side + 1) % 4 < 2) == (type == Value.GROOVE) ? new Color[] { getShadowColor(color), getLightColor(color) } : new Color[] { getLightColor(color), getShadowColor(color) }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
Example 17
Source File: CSSBorder.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 2, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = ((side + 1) % 4 < 2) == (type == Value.GROOVE) ? new Color[] { getShadowColor(color), getLightColor(color) } : new Color[] { getLightColor(color), getShadowColor(color) }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
Example 18
Source File: CSSBorder.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 3, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = { color, null }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
Example 19
Source File: CSSBorder.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 3, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = { color, null }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }
Example 20
Source File: CSSBorder.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void paint(Polygon shape, Graphics g, Color color, int side) { Rectangle r = shape.getBounds(); int length = Math.max(r.height / 2, 1); int[] lengthPattern = { length, length }; Color[] colorPattern = ((side + 1) % 4 < 2) == (type == Value.GROOVE) ? new Color[] { getShadowColor(color), getLightColor(color) } : new Color[] { getLightColor(color), getShadowColor(color) }; paintStrokes(r, g, View.Y_AXIS, lengthPattern, colorPattern); }