/** Check the bounds of given line with the bounds of this pane. Optionally * calculate the new bounds in current pane's boundary. * @param line a line for check * @return a line with bounds inside the pane's boundary */ private Line2D checkLineBounds (Line2D line) { Rectangle bounds = getBounds(); double startPointX, startPointY, endPointX, endPointY; // check start point startPointX = Math.max (line.getX1 (), bounds.x+MIN_X); startPointY = Math.max (line.getY1 (), bounds.y+MIN_Y); // check end point endPointX = Math.min (line.getX2 (), (bounds.x+bounds.width)-MIN_WIDTH); endPointY = Math.min (line.getY2 (), (bounds.y+bounds.height)-MIN_HEIGTH); // set new bounds line.setLine(startPointX, startPointY, endPointX, endPointY); return line; }
/** Check the bounds of given line with the bounds of this pane. Optionally * calculate the new bounds in current pane's boundary. * @param line a line for check * @return a line with bounds inside the pane's boundary */ private Line2D checkLineBounds (Line2D line) { Rectangle bounds = getBounds(); double startPointX, startPointY, endPointX, endPointY; // check start point startPointX = Math.max (line.getX1 (), bounds.x+MIN_X); startPointY = Math.max (line.getY1 (), bounds.y+MIN_Y); // check end point endPointX = Math.min (line.getX2 (), (bounds.x+bounds.width)-MIN_WIDTH); endPointY = Math.min (line.getY2 (), (bounds.y+bounds.height)-MIN_HEIGTH); // set new bounds line.setLine(startPointX, startPointY, endPointX, endPointY); return line; }
/** Check the bounds of given line with the bounds of this pane. Optionally * calculate the new bounds in current pane's boundary. * @param line a line for check * @return a line with bounds inside the pane's boundary */ private Line2D checkLineBounds(Line2D line) { Rectangle bounds = getBounds(); double startPointX; double startPointY; double endPointX; double endPointY; // check start point startPointX = Math.max(line.getX1(), bounds.x + MIN_X); startPointY = Math.max(line.getY1(), bounds.y + MIN_Y); // check end point endPointX = Math.min(line.getX2(), (bounds.x + bounds.width) - MIN_WIDTH); endPointY = Math.min(line.getY2(), (bounds.y + bounds.height) - MIN_HEIGTH); // set new bounds line.setLine(startPointX, startPointY, endPointX, endPointY); return line; }