Java Code Examples for org.jfree.ui.RectangleAnchor#RIGHT
The following examples show how to use
org.jfree.ui.RectangleAnchor#RIGHT .
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: CategoricalChartExpression.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
public RectangleAnchor asRectangleAnchor() { switch ( this ) { case RIGHT: return RectangleAnchor.RIGHT; case TOP_RIGHT: return RectangleAnchor.TOP_RIGHT; case TOP: return RectangleAnchor.TOP; case TOP_LEFT: return RectangleAnchor.TOP_LEFT; case LEFT: return RectangleAnchor.LEFT; case BOTTOM_LEFT: return RectangleAnchor.BOTTOM_LEFT; case BOTTOM: return RectangleAnchor.BOTTOM; case BOTTOM_RIGHT: return RectangleAnchor.BOTTOM_RIGHT; default: return null; } }
Example 2
Source File: CategoryLabelPositions.java From opensim-gui with Apache License 2.0 | 6 votes |
/** * Creates a new instance where the category labels angled downwards by the * specified amount. * * @param angle the rotation angle (should be < Math.PI / 2.0). * * @return A category label position specification. */ public static CategoryLabelPositions createDownRotationLabelPositions( double angle) { return new CategoryLabelPositions( new CategoryLabelPosition( RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_RIGHT, TextAnchor.BOTTOM_RIGHT, angle, CategoryLabelWidthType.RANGE, 0.50f ), // TOP new CategoryLabelPosition( RectangleAnchor.TOP, TextBlockAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, angle, CategoryLabelWidthType.RANGE, 0.50f ), // BOTTOM new CategoryLabelPosition( RectangleAnchor.RIGHT, TextBlockAnchor.TOP_RIGHT, TextAnchor.TOP_RIGHT, angle, CategoryLabelWidthType.RANGE, 0.50f ), // LEFT new CategoryLabelPosition( RectangleAnchor.LEFT, TextBlockAnchor.BOTTOM_LEFT, TextAnchor.BOTTOM_LEFT, angle, CategoryLabelWidthType.RANGE, 0.50f ) // RIGHT ); }
Example 3
Source File: CategoryLabelPositions.java From opensim-gui with Apache License 2.0 | 6 votes |
/** * Creates a new instance where the category labels angled upwards by the * specified amount. * * @param angle the rotation angle (should be < Math.PI / 2.0). * * @return A category label position specification. */ public static CategoryLabelPositions createUpRotationLabelPositions( double angle) { return new CategoryLabelPositions( new CategoryLabelPosition( RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_LEFT, TextAnchor.BOTTOM_LEFT, -angle, CategoryLabelWidthType.RANGE, 0.50f ), // TOP new CategoryLabelPosition( RectangleAnchor.TOP, TextBlockAnchor.TOP_RIGHT, TextAnchor.TOP_RIGHT, -angle, CategoryLabelWidthType.RANGE, 0.50f ), // BOTTOM new CategoryLabelPosition( RectangleAnchor.RIGHT, TextBlockAnchor.BOTTOM_RIGHT, TextAnchor.BOTTOM_RIGHT, -angle, CategoryLabelWidthType.RANGE, 0.50f ), // LEFT new CategoryLabelPosition( RectangleAnchor.LEFT, TextBlockAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, -angle, CategoryLabelWidthType.RANGE, 0.50f ) // RIGHT ); }
Example 4
Source File: CrosshairOverlay.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
private RectangleAnchor flipAnchorH(RectangleAnchor anchor) { RectangleAnchor result = anchor; if (anchor.equals(RectangleAnchor.TOP_LEFT)) { result = RectangleAnchor.TOP_RIGHT; } else if (anchor.equals(RectangleAnchor.TOP_RIGHT)) { result = RectangleAnchor.TOP_LEFT; } else if (anchor.equals(RectangleAnchor.LEFT)) { result = RectangleAnchor.RIGHT; } else if (anchor.equals(RectangleAnchor.RIGHT)) { result = RectangleAnchor.LEFT; } else if (anchor.equals(RectangleAnchor.BOTTOM_LEFT)) { result = RectangleAnchor.BOTTOM_RIGHT; } else if (anchor.equals(RectangleAnchor.BOTTOM_RIGHT)) { result = RectangleAnchor.BOTTOM_LEFT; } return result; }
Example 5
Source File: CategoryLabelPositions.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Creates a new instance where the category labels angled downwards by the * specified amount. * * @param angle the rotation angle (should be < Math.PI / 2.0). * * @return A category label position specification. */ public static CategoryLabelPositions createDownRotationLabelPositions( double angle) { return new CategoryLabelPositions( new CategoryLabelPosition( RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_RIGHT, TextAnchor.BOTTOM_RIGHT, angle, CategoryLabelWidthType.RANGE, 0.50f), // TOP new CategoryLabelPosition( RectangleAnchor.TOP, TextBlockAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, angle, CategoryLabelWidthType.RANGE, 0.50f), // BOTTOM new CategoryLabelPosition( RectangleAnchor.RIGHT, TextBlockAnchor.TOP_RIGHT, TextAnchor.TOP_RIGHT, angle, CategoryLabelWidthType.RANGE, 0.50f), // LEFT new CategoryLabelPosition( RectangleAnchor.LEFT, TextBlockAnchor.BOTTOM_LEFT, TextAnchor.BOTTOM_LEFT, angle, CategoryLabelWidthType.RANGE, 0.50f) // RIGHT ); }
Example 6
Source File: CategoryLabelPositions.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Creates a new instance where the category labels angled upwards by the * specified amount. * * @param angle the rotation angle (should be < Math.PI / 2.0). * * @return A category label position specification. */ public static CategoryLabelPositions createUpRotationLabelPositions( double angle) { return new CategoryLabelPositions( new CategoryLabelPosition( RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_LEFT, TextAnchor.BOTTOM_LEFT, -angle, CategoryLabelWidthType.RANGE, 0.50f), // TOP new CategoryLabelPosition( RectangleAnchor.TOP, TextBlockAnchor.TOP_RIGHT, TextAnchor.TOP_RIGHT, -angle, CategoryLabelWidthType.RANGE, 0.50f), // BOTTOM new CategoryLabelPosition( RectangleAnchor.RIGHT, TextBlockAnchor.BOTTOM_RIGHT, TextAnchor.BOTTOM_RIGHT, -angle, CategoryLabelWidthType.RANGE, 0.50f), // LEFT new CategoryLabelPosition( RectangleAnchor.LEFT, TextBlockAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, -angle, CategoryLabelWidthType.RANGE, 0.50f) // RIGHT ); }
Example 7
Source File: DialValueIndicator.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Creates a new instance of <code>DialValueIndicator</code>. * * @param datasetIndex the dataset index. */ public DialValueIndicator(int datasetIndex) { this.datasetIndex = datasetIndex; this.angle = -90.0; this.radius = 0.3; this.frameAnchor = RectangleAnchor.CENTER; this.templateValue = new Double(100.0); this.maxTemplateValue = null; this.formatter = new DecimalFormat("0.0"); this.font = new Font("Dialog", Font.BOLD, 14); this.paint = Color.black; this.backgroundPaint = Color.white; this.outlineStroke = new BasicStroke(1.0f); this.outlinePaint = Color.blue; this.insets = new RectangleInsets(4, 4, 4, 4); this.valueAnchor = RectangleAnchor.RIGHT; this.textAnchor = TextAnchor.CENTER_RIGHT; }
Example 8
Source File: CrosshairOverlay.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
private RectangleAnchor flipAnchorH(RectangleAnchor anchor) { RectangleAnchor result = anchor; if (anchor.equals(RectangleAnchor.TOP_LEFT)) { result = RectangleAnchor.TOP_RIGHT; } else if (anchor.equals(RectangleAnchor.TOP_RIGHT)) { result = RectangleAnchor.TOP_LEFT; } else if (anchor.equals(RectangleAnchor.LEFT)) { result = RectangleAnchor.RIGHT; } else if (anchor.equals(RectangleAnchor.RIGHT)) { result = RectangleAnchor.LEFT; } else if (anchor.equals(RectangleAnchor.BOTTOM_LEFT)) { result = RectangleAnchor.BOTTOM_RIGHT; } else if (anchor.equals(RectangleAnchor.BOTTOM_RIGHT)) { result = RectangleAnchor.BOTTOM_LEFT; } return result; }
Example 9
Source File: CategoryLabelPositions.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Creates a new instance where the category labels angled downwards by the * specified amount. * * @param angle the rotation angle (should be < Math.PI / 2.0). * * @return A category label position specification. */ public static CategoryLabelPositions createDownRotationLabelPositions( double angle) { return new CategoryLabelPositions( new CategoryLabelPosition( RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_RIGHT, TextAnchor.BOTTOM_RIGHT, angle, CategoryLabelWidthType.RANGE, 0.50f), // TOP new CategoryLabelPosition( RectangleAnchor.TOP, TextBlockAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, angle, CategoryLabelWidthType.RANGE, 0.50f), // BOTTOM new CategoryLabelPosition( RectangleAnchor.RIGHT, TextBlockAnchor.TOP_RIGHT, TextAnchor.TOP_RIGHT, angle, CategoryLabelWidthType.RANGE, 0.50f), // LEFT new CategoryLabelPosition( RectangleAnchor.LEFT, TextBlockAnchor.BOTTOM_LEFT, TextAnchor.BOTTOM_LEFT, angle, CategoryLabelWidthType.RANGE, 0.50f) // RIGHT ); }
Example 10
Source File: CategoryLabelPositions.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Creates a new instance where the category labels angled upwards by the * specified amount. * * @param angle the rotation angle (should be < Math.PI / 2.0). * * @return A category label position specification. */ public static CategoryLabelPositions createUpRotationLabelPositions( double angle) { return new CategoryLabelPositions( new CategoryLabelPosition( RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_LEFT, TextAnchor.BOTTOM_LEFT, -angle, CategoryLabelWidthType.RANGE, 0.50f), // TOP new CategoryLabelPosition( RectangleAnchor.TOP, TextBlockAnchor.TOP_RIGHT, TextAnchor.TOP_RIGHT, -angle, CategoryLabelWidthType.RANGE, 0.50f), // BOTTOM new CategoryLabelPosition( RectangleAnchor.RIGHT, TextBlockAnchor.BOTTOM_RIGHT, TextAnchor.BOTTOM_RIGHT, -angle, CategoryLabelWidthType.RANGE, 0.50f), // LEFT new CategoryLabelPosition( RectangleAnchor.LEFT, TextBlockAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, -angle, CategoryLabelWidthType.RANGE, 0.50f) // RIGHT ); }
Example 11
Source File: DialValueIndicator.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
/** * Creates a new instance of <code>DialValueIndicator</code>. * * @param datasetIndex the dataset index. */ public DialValueIndicator(int datasetIndex) { this.datasetIndex = datasetIndex; this.angle = -90.0; this.radius = 0.3; this.frameAnchor = RectangleAnchor.CENTER; this.templateValue = new Double(100.0); this.maxTemplateValue = null; this.formatter = new DecimalFormat("0.0"); this.font = new Font("Dialog", Font.BOLD, 14); this.paint = Color.black; this.backgroundPaint = Color.white; this.outlineStroke = new BasicStroke(1.0f); this.outlinePaint = Color.blue; this.insets = new RectangleInsets(4, 4, 4, 4); this.valueAnchor = RectangleAnchor.RIGHT; this.textAnchor = TextAnchor.CENTER_RIGHT; }
Example 12
Source File: CategoryLabelPositions.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates a new instance where the category labels angled upwards by the * specified amount. * * @param angle the rotation angle (should be < Math.PI / 2.0). * * @return A category label position specification. */ public static CategoryLabelPositions createUpRotationLabelPositions( double angle) { return new CategoryLabelPositions( new CategoryLabelPosition( RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_LEFT, TextAnchor.BOTTOM_LEFT, -angle, CategoryLabelWidthType.RANGE, 0.50f), // TOP new CategoryLabelPosition( RectangleAnchor.TOP, TextBlockAnchor.TOP_RIGHT, TextAnchor.TOP_RIGHT, -angle, CategoryLabelWidthType.RANGE, 0.50f), // BOTTOM new CategoryLabelPosition( RectangleAnchor.RIGHT, TextBlockAnchor.BOTTOM_RIGHT, TextAnchor.BOTTOM_RIGHT, -angle, CategoryLabelWidthType.RANGE, 0.50f), // LEFT new CategoryLabelPosition( RectangleAnchor.LEFT, TextBlockAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, -angle, CategoryLabelWidthType.RANGE, 0.50f) // RIGHT ); }
Example 13
Source File: CategoryLabelPositions.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates a new instance where the category labels angled downwards by the * specified amount. * * @param angle the rotation angle (should be < Math.PI / 2.0). * * @return A category label position specification. */ public static CategoryLabelPositions createDownRotationLabelPositions( double angle) { return new CategoryLabelPositions( new CategoryLabelPosition( RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_RIGHT, TextAnchor.BOTTOM_RIGHT, angle, CategoryLabelWidthType.RANGE, 0.50f), // TOP new CategoryLabelPosition( RectangleAnchor.TOP, TextBlockAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, angle, CategoryLabelWidthType.RANGE, 0.50f), // BOTTOM new CategoryLabelPosition( RectangleAnchor.RIGHT, TextBlockAnchor.TOP_RIGHT, TextAnchor.TOP_RIGHT, angle, CategoryLabelWidthType.RANGE, 0.50f), // LEFT new CategoryLabelPosition( RectangleAnchor.LEFT, TextBlockAnchor.BOTTOM_LEFT, TextAnchor.BOTTOM_LEFT, angle, CategoryLabelWidthType.RANGE, 0.50f) // RIGHT ); }
Example 14
Source File: CrosshairOverlay.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
private RectangleAnchor flipAnchorH(RectangleAnchor anchor) { RectangleAnchor result = anchor; if (anchor.equals(RectangleAnchor.TOP_LEFT)) { result = RectangleAnchor.TOP_RIGHT; } else if (anchor.equals(RectangleAnchor.TOP_RIGHT)) { result = RectangleAnchor.TOP_LEFT; } else if (anchor.equals(RectangleAnchor.LEFT)) { result = RectangleAnchor.RIGHT; } else if (anchor.equals(RectangleAnchor.RIGHT)) { result = RectangleAnchor.LEFT; } else if (anchor.equals(RectangleAnchor.BOTTOM_LEFT)) { result = RectangleAnchor.BOTTOM_RIGHT; } else if (anchor.equals(RectangleAnchor.BOTTOM_RIGHT)) { result = RectangleAnchor.BOTTOM_LEFT; } return result; }
Example 15
Source File: DialValueIndicator.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates a new instance of <code>DialValueIndicator</code>. * * @param datasetIndex the dataset index. */ public DialValueIndicator(int datasetIndex) { this.datasetIndex = datasetIndex; this.angle = -90.0; this.radius = 0.3; this.frameAnchor = RectangleAnchor.CENTER; this.templateValue = new Double(100.0); this.maxTemplateValue = null; this.formatter = new DecimalFormat("0.0"); this.font = new Font("Dialog", Font.BOLD, 14); this.paint = Color.black; this.backgroundPaint = Color.white; this.outlineStroke = new BasicStroke(1.0f); this.outlinePaint = Color.blue; this.insets = new RectangleInsets(4, 4, 4, 4); this.valueAnchor = RectangleAnchor.RIGHT; this.textAnchor = TextAnchor.CENTER_RIGHT; }
Example 16
Source File: CrosshairOverlay.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
private RectangleAnchor flipAnchorH(RectangleAnchor anchor) { RectangleAnchor result = anchor; if (anchor.equals(RectangleAnchor.TOP_LEFT)) { result = RectangleAnchor.TOP_RIGHT; } else if (anchor.equals(RectangleAnchor.TOP_RIGHT)) { result = RectangleAnchor.TOP_LEFT; } else if (anchor.equals(RectangleAnchor.LEFT)) { result = RectangleAnchor.RIGHT; } else if (anchor.equals(RectangleAnchor.RIGHT)) { result = RectangleAnchor.LEFT; } else if (anchor.equals(RectangleAnchor.BOTTOM_LEFT)) { result = RectangleAnchor.BOTTOM_RIGHT; } else if (anchor.equals(RectangleAnchor.BOTTOM_RIGHT)) { result = RectangleAnchor.BOTTOM_LEFT; } return result; }
Example 17
Source File: CategoryLabelPositions.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates a new instance where the category labels angled downwards by the * specified amount. * * @param angle the rotation angle (should be < Math.PI / 2.0). * * @return A category label position specification. */ public static CategoryLabelPositions createDownRotationLabelPositions( double angle) { return new CategoryLabelPositions( new CategoryLabelPosition( RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_RIGHT, TextAnchor.BOTTOM_RIGHT, angle, CategoryLabelWidthType.RANGE, 0.50f), // TOP new CategoryLabelPosition( RectangleAnchor.TOP, TextBlockAnchor.TOP_LEFT, TextAnchor.TOP_LEFT, angle, CategoryLabelWidthType.RANGE, 0.50f), // BOTTOM new CategoryLabelPosition( RectangleAnchor.RIGHT, TextBlockAnchor.TOP_RIGHT, TextAnchor.TOP_RIGHT, angle, CategoryLabelWidthType.RANGE, 0.50f), // LEFT new CategoryLabelPosition( RectangleAnchor.LEFT, TextBlockAnchor.BOTTOM_LEFT, TextAnchor.BOTTOM_LEFT, angle, CategoryLabelWidthType.RANGE, 0.50f) // RIGHT ); }
Example 18
Source File: CrosshairOverlay.java From SIMVA-SoS with Apache License 2.0 | 4 votes |
/** * Calculates the anchor point for a label. * * @param line the line for the crosshair. * @param anchor the anchor point. * @param deltaX the x-offset. * @param deltaY the y-offset. * * @return The anchor point. */ private Point2D calculateLabelPoint(Line2D line, RectangleAnchor anchor, double deltaX, double deltaY) { double x, y; boolean left = (anchor == RectangleAnchor.BOTTOM_LEFT || anchor == RectangleAnchor.LEFT || anchor == RectangleAnchor.TOP_LEFT); boolean right = (anchor == RectangleAnchor.BOTTOM_RIGHT || anchor == RectangleAnchor.RIGHT || anchor == RectangleAnchor.TOP_RIGHT); boolean top = (anchor == RectangleAnchor.TOP_LEFT || anchor == RectangleAnchor.TOP || anchor == RectangleAnchor.TOP_RIGHT); boolean bottom = (anchor == RectangleAnchor.BOTTOM_LEFT || anchor == RectangleAnchor.BOTTOM || anchor == RectangleAnchor.BOTTOM_RIGHT); Rectangle rect = line.getBounds(); // we expect the line to be vertical or horizontal if (line.getX1() == line.getX2()) { // vertical x = line.getX1(); y = (line.getY1() + line.getY2()) / 2.0; if (left) { x = x - deltaX; } if (right) { x = x + deltaX; } if (top) { y = Math.min(line.getY1(), line.getY2()) + deltaY; } if (bottom) { y = Math.max(line.getY1(), line.getY2()) - deltaY; } } else { // horizontal x = (line.getX1() + line.getX2()) / 2.0; y = line.getY1(); if (left) { x = Math.min(line.getX1(), line.getX2()) + deltaX; } if (right) { x = Math.max(line.getX1(), line.getX2()) - deltaX; } if (top) { y = y - deltaY; } if (bottom) { y = y + deltaY; } } return new Point2D.Double(x, y); }
Example 19
Source File: CrosshairOverlay.java From ECG-Viewer with GNU General Public License v2.0 | 4 votes |
/** * Calculates the anchor point for a label. * * @param line the line for the crosshair. * @param anchor the anchor point. * @param deltaX the x-offset. * @param deltaY the y-offset. * * @return The anchor point. */ private Point2D calculateLabelPoint(Line2D line, RectangleAnchor anchor, double deltaX, double deltaY) { double x, y; boolean left = (anchor == RectangleAnchor.BOTTOM_LEFT || anchor == RectangleAnchor.LEFT || anchor == RectangleAnchor.TOP_LEFT); boolean right = (anchor == RectangleAnchor.BOTTOM_RIGHT || anchor == RectangleAnchor.RIGHT || anchor == RectangleAnchor.TOP_RIGHT); boolean top = (anchor == RectangleAnchor.TOP_LEFT || anchor == RectangleAnchor.TOP || anchor == RectangleAnchor.TOP_RIGHT); boolean bottom = (anchor == RectangleAnchor.BOTTOM_LEFT || anchor == RectangleAnchor.BOTTOM || anchor == RectangleAnchor.BOTTOM_RIGHT); Rectangle rect = line.getBounds(); // we expect the line to be vertical or horizontal if (line.getX1() == line.getX2()) { // vertical x = line.getX1(); y = (line.getY1() + line.getY2()) / 2.0; if (left) { x = x - deltaX; } if (right) { x = x + deltaX; } if (top) { y = Math.min(line.getY1(), line.getY2()) + deltaY; } if (bottom) { y = Math.max(line.getY1(), line.getY2()) - deltaY; } } else { // horizontal x = (line.getX1() + line.getX2()) / 2.0; y = line.getY1(); if (left) { x = Math.min(line.getX1(), line.getX2()) + deltaX; } if (right) { x = Math.max(line.getX1(), line.getX2()) - deltaX; } if (top) { y = y - deltaY; } if (bottom) { y = y + deltaY; } } return new Point2D.Double(x, y); }
Example 20
Source File: CrosshairOverlay.java From buffer_bci with GNU General Public License v3.0 | 4 votes |
/** * Calculates the anchor point for a label. * * @param line the line for the crosshair. * @param anchor the anchor point. * @param deltaX the x-offset. * @param deltaY the y-offset. * * @return The anchor point. */ private Point2D calculateLabelPoint(Line2D line, RectangleAnchor anchor, double deltaX, double deltaY) { double x, y; boolean left = (anchor == RectangleAnchor.BOTTOM_LEFT || anchor == RectangleAnchor.LEFT || anchor == RectangleAnchor.TOP_LEFT); boolean right = (anchor == RectangleAnchor.BOTTOM_RIGHT || anchor == RectangleAnchor.RIGHT || anchor == RectangleAnchor.TOP_RIGHT); boolean top = (anchor == RectangleAnchor.TOP_LEFT || anchor == RectangleAnchor.TOP || anchor == RectangleAnchor.TOP_RIGHT); boolean bottom = (anchor == RectangleAnchor.BOTTOM_LEFT || anchor == RectangleAnchor.BOTTOM || anchor == RectangleAnchor.BOTTOM_RIGHT); Rectangle rect = line.getBounds(); // we expect the line to be vertical or horizontal if (line.getX1() == line.getX2()) { // vertical x = line.getX1(); y = (line.getY1() + line.getY2()) / 2.0; if (left) { x = x - deltaX; } if (right) { x = x + deltaX; } if (top) { y = Math.min(line.getY1(), line.getY2()) + deltaY; } if (bottom) { y = Math.max(line.getY1(), line.getY2()) - deltaY; } } else { // horizontal x = (line.getX1() + line.getX2()) / 2.0; y = line.getY1(); if (left) { x = Math.min(line.getX1(), line.getX2()) + deltaX; } if (right) { x = Math.max(line.getX1(), line.getX2()) - deltaX; } if (top) { y = y - deltaY; } if (bottom) { y = y + deltaY; } } return new Point2D.Double(x, y); }