/** * */ public void paint(Graphics g) { if (currentState != null && first != null) { Rectangle rect = currentState.getRectangle(); double deg = currentAngle * mxConstants.DEG_PER_RAD; if (deg != 0) { ((Graphics2D) g).rotate(Math.toRadians(deg), currentState.getCenterX(), currentState.getCenterY()); } mxUtils.setAntiAlias((Graphics2D) g, true, false); g.drawRect(rect.x, rect.y, rect.width, rect.height); } }
/** * */ public void paint(Graphics g) { if (currentState != null && first != null) { Rectangle rect = currentState.getRectangle(); double deg = currentAngle * mxConstants.DEG_PER_RAD; if (deg != 0) { ((Graphics2D) g).rotate(Math.toRadians(deg), currentState.getCenterX(), currentState.getCenterY()); } mxUtils.setAntiAlias((Graphics2D) g, true, false); g.drawRect(rect.x, rect.y, rect.width, rect.height); } }
point = new mxPoint(opposite.getCenterX(), opposite.getCenterY());
point = new mxPoint(opposite.getCenterX(), opposite.getCenterY());
/** * Returns the y-coordinate of the center point for automatic routing. * * @return Returns the y-coordinate of the routing center point. */ public double getRoutingCenterY(mxCellState state) { float f = (state.getStyle() != null) ? mxUtils.getFloat( state.getStyle(), mxConstants.STYLE_ROUTING_CENTER_Y) : 0; return state.getCenterY() + f * state.getHeight(); }
/** * Returns the y-coordinate of the center point for automatic routing. * * @return Returns the y-coordinate of the routing center point. */ public double getRoutingCenterY(mxCellState state) { float f = (state.getStyle() != null) ? mxUtils.getFloat( state.getStyle(), mxConstants.STYLE_ROUTING_CENTER_Y) : 0; return state.getCenterY() + f * state.getHeight(); }
int cy = (int) Math.round(state.getCenterY()); int width = (int) Math.round(state.getWidth()); int height = (int) Math.round(state.getHeight());
int cy = (int) Math.round(state.getCenterY()); int width = (int) Math.round(state.getWidth()); int height = (int) Math.round(state.getHeight());
double cy = currentState.getCenterY(); double dx = pt.getX() - cx; double dy = pt.getY() - cy;
double cy = currentState.getCenterY(); double dx = pt.getX() - cx; double dy = pt.getY() - cy;
int y = (int)(state.getCenterY()); Image img = Toolkit.getDefaultToolkit().getImage(<PATH TO YOUR IMAGE>); previousGraphics.drawImage(img, x, y, null);
/** * */ public mxPoint[] createPoints(mxGraphics2DCanvas canvas, mxCellState state) { String direction = mxUtils.getString(state.getStyle(), mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_EAST); mxPoint p0, pe; if (direction.equals(mxConstants.DIRECTION_EAST) || direction.equals(mxConstants.DIRECTION_WEST)) { double mid = state.getCenterY(); p0 = new mxPoint(state.getX(), mid); pe = new mxPoint(state.getX() + state.getWidth(), mid); } else { double mid = state.getCenterX(); p0 = new mxPoint(mid, state.getY()); pe = new mxPoint(mid, state.getY() + state.getHeight()); } mxPoint[] points = new mxPoint[2]; points[0] = p0; points[1] = pe; return points; }
/** * */ public mxPoint[] createPoints(mxGraphics2DCanvas canvas, mxCellState state) { String direction = mxUtils.getString(state.getStyle(), mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_EAST); mxPoint p0, pe; if (direction.equals(mxConstants.DIRECTION_EAST) || direction.equals(mxConstants.DIRECTION_WEST)) { double mid = state.getCenterY(); p0 = new mxPoint(state.getX(), mid); pe = new mxPoint(state.getX() + state.getWidth(), mid); } else { double mid = state.getCenterX(); p0 = new mxPoint(mid, state.getY()); pe = new mxPoint(mid, state.getY() + state.getHeight()); } mxPoint[] points = new mxPoint[2]; points[0] = p0; points[1] = pe; return points; }
/** * Updates the style of the edge preview from the incoming edge */ public void start(MouseEvent e, mxCellState startState, String style) { mxGraph graph = graphComponent.getGraph(); sourceState = startState; startPoint = transformScreenPoint(startState.getCenterX(), startState.getCenterY()); Object cell = createCell(startState, style); graph.getView().validateCell(cell); previewState = graph.getView().getState(cell); fireEvent(new mxEventObject(mxEvent.START, "event", e, "state", previewState)); }
/** * Updates the style of the edge preview from the incoming edge */ public void start(MouseEvent e, mxCellState startState, String style) { mxGraph graph = graphComponent.getGraph(); sourceState = startState; startPoint = transformScreenPoint(startState.getCenterX(), startState.getCenterY()); Object cell = createCell(startState, style); graph.getView().validateCell(cell); previewState = graph.getView().getState(cell); fireEvent(new mxEventObject(mxEvent.START, "event", e, "state", previewState)); }
int y = (int) source.getCenterY() - imgHeight / 2;
int y = (int) source.getCenterY() - imgHeight / 2;
double y = state.getCenterY();
double y = state.getCenterY();