Package javax.swing

Examples of javax.swing.CellRendererPane$AccessibleCellRendererPane


  public void paintShape(mxGraphics2DCanvas canvas, String text,
      mxCellState state, Map<String, Object> style)
  {
    mxLightweightLabel textRenderer = mxLightweightLabel
        .getSharedInstance();
    CellRendererPane rendererPane = canvas.getRendererPane();
    Rectangle rect = state.getLabelBounds().getRectangle();
    Graphics2D g = canvas.getGraphics();

    if (textRenderer != null
        && rendererPane != null
        && (g.getClipBounds() == null || g.getClipBounds().intersects(
            rect)))
    {
      double scale = canvas.getScale();
      int x = rect.x;
      int y = rect.y;
      int w = rect.width;
      int h = rect.height;

      if (!mxUtils.isTrue(style, mxConstants.STYLE_HORIZONTAL, true))
      {
        g.rotate(-Math.PI / 2, x + w / 2, y + h / 2);
        g.translate(w / 2 - h / 2, h / 2 - w / 2);

        int tmp = w;
        w = h;
        h = tmp;
      }

      // Renders the scaled text
      textRenderer.setText(mxUtils.createHtmlDocument(style, text));
      textRenderer.setFont(mxUtils.getFont(style, canvas.getScale()));
      g.scale(scale, scale);
      textRenderer.updateUI();
      rendererPane.paintComponent(g, textRenderer, rendererPane,
          (int) (x / scale) + mxConstants.LABEL_INSET,
          (int) (y / scale) + mxConstants.LABEL_INSET,
          (int) (w / scale), (int) (h / scale), true);
    }
  }
View Full Code Here


    this.g = g;

    // Initializes the cell renderer pane for drawing HTML markup
    try
    {
      rendererPane = new CellRendererPane();
    }
    catch (Exception e)
    {
      // ignore
    }
View Full Code Here

    */
   
//    SwingUtilities.paintComponent(g, c, con, rect); 
    //The following does what SwingUtilities.paintComponent does
    if (crp == null){
      crp = new CellRendererPane();
    }
    crp.add(c);
    con.add(crp);
    crp.paintComponent(g, c, con, rect.x, rect.y, rect.width, rect.height, false);
    //FIXME TEST, BENEFITS?
View Full Code Here

TOP

Related Classes of javax.swing.CellRendererPane$AccessibleCellRendererPane

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.