Example usage for java.awt RenderingHints KEY_TEXT_ANTIALIASING

List of usage examples for java.awt RenderingHints KEY_TEXT_ANTIALIASING

Introduction

In this page you can find the example usage for java.awt RenderingHints KEY_TEXT_ANTIALIASING.

Prototype

Key KEY_TEXT_ANTIALIASING

To view the source code for java.awt RenderingHints KEY_TEXT_ANTIALIASING.

Click Source Link

Document

Text antialiasing hint key.

Usage

From source file:com.igormaznitsa.jhexed.renders.svg.SVGImage.java

private static void processAntialias(final boolean flag, final Graphics2D g) {
    if (flag) {// w  ww.  ja  v  a 2  s.  c  o  m
        g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
                RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
    } else {
        g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
        g.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
                RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED);
    }
}

From source file:figs.treeVisualization.gui.TimeAxisTree2DPanel.java

/**
 *  Paint this Component using the Tree2DPainter with TimeBars
 *
 *  @param g the graphics device/*from  www . j a va2s.c  o  m*/
 */
@Override
protected void paintComponent(Graphics g) {
    super.paintComponent(g);

    Graphics2D g2 = (Graphics2D) g.create();

    /**
     * Enable antialiased graphics.
     */
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

    Dimension currentSize = this.getSize();

    /**
     * Check to see if this component has changed size or if this
     * is our first time drawing.
     */
    if (this.fDimension == null || !this.fDimension.equals(currentSize) || this.fTreeArea == null
            || this.fLeftTreeArea == null || this.fEstMaxDateWidth == null) {
        this.fDimension = currentSize;

        this.fTreeArea = new Rectangle2D.Double(0, 0, currentSize.getWidth(), currentSize.getHeight());

        /** Adjust the width ratio using the maximum date width. */
        this.refreshLeafNodes();
        this.estimateMaximumDateWidth(g2);
        if ((this.fEstMaxDateWidth * 2) > (this.fTreeArea.getWidth() * this.fTreeWidthRatio)
                - this.fTreeArea.getWidth()) {
            this.fTreeWidthRatio = (this.fTreeArea.getWidth() - (this.fEstMaxDateWidth * 2))
                    / this.fTreeArea.getWidth();
        }

        /** Make left tree area for tree. */
        this.fLeftTreeArea = new Rectangle2D.Double(0, 0, this.fTreeArea.getWidth() * this.fTreeWidthRatio,
                this.fTreeArea.getHeight());

        /** Now, clear the right tree area so that it will be recalculated. */
        this.fRightTreeArea = null;
    }

    /** Paint the tree. */
    this.fTreePainter.drawTree(g2, this.fLeftTreeArea);

    /**
     * Check to see if we have calculated the date data.
     * The order of this is very important. We need to have
     * called the painter before we can get the coordinates.
     */
    if (this.fLeafNodes.isEmpty() || this.fLeafDates.isEmpty())
        /** Just calculate the Leaf data. */
        this.refreshLeafNodes();

    /**
     *  Draw the date axis and lines to the leaf nodes.
     */
    if (fTopLeafDate != null || fBottomLeafDate != null) {

        if (this.fRightTreeArea == null) {
            calculateDateMargins();
            this.fRightTreeArea = new Rectangle2D.Double(this.fTreeArea.getWidth() * this.fTreeWidthRatio,
                    this.fTopLeafPt.getY(), this.fTreeArea.getWidth(), this.fBottomLeafPt.getY());
        }

        double cursor = this.fRightTreeArea.getX()
                + ((this.fRightTreeArea.getWidth() - this.fRightTreeArea.getX()) / 2);
        drawDateAxis(g2, cursor, this.fRightTreeArea);
        drawDatesToLeafs(g2, cursor, this.fRightTreeArea);
    } else {
        // g2."No TIME INFORMATION AVAILABLE
        // g2.drawString("NO TIME INFORMATION AVAILABLE", x, y);
        System.out.println("TimeBarPanel: No time information available!");
    }

    if (this.fMousePressed && this.fMouseSelectionRect != null) {
        /** Color of line varies depending on image colors. */
        g2.setXORMode(Color.white);
        g2.drawRect(this.fMouseSelectionRect.x, this.fMouseSelectionRect.y, this.fMouseSelectionRect.width - 1,
                this.fMouseSelectionRect.height - 1);
    }

}

From source file:net.fenyo.gnetwatch.GUI.BasicComponent.java

/**
 * Creates a backing store.//from   ww  w  .  jav  a  2  s.  c o m
 * @param none.
 * @return void.
 */
private void newBackingElts() {
    dimension = getSize();
    backing_store = createImage(dimension.width, dimension.height);
    backing_g = (Graphics2D) backing_store.getGraphics();
    backing_g.setBackground(Color.BLACK);
    backing_g.setColor(Color.WHITE);
    backing_g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    backing_g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
}

From source file:net.pms.util.GenericIcons.java

/**
 * Add the format(container) name of the media to the generic icon image.
 *
 * @param image BufferdImage to be the label added
 * @param label the media container name to be added as a label
 * @param renderer the renderer configuration
 *
 * @return the generic icon with the container label added and scaled in accordance with renderer setting
 *///ww w . ja  v  a  2s .  co  m
private DLNAThumbnail addFormatLabelToImage(String label, ImageFormat imageFormat, IconType iconType)
        throws IOException {

    BufferedImage image;
    switch (iconType) {
    case AUDIO:
        image = genericAudioIcon;
        break;
    case IMAGE:
        image = genericImageIcon;
        break;
    case VIDEO:
        image = genericVideoIcon;
        break;
    default:
        image = genericUnknownIcon;
    }

    if (image != null) {
        // Make a copy
        ColorModel colorModel = image.getColorModel();
        image = new BufferedImage(colorModel, image.copyData(null), colorModel.isAlphaPremultiplied(), null);
    }

    ByteArrayOutputStream out = null;

    if (label != null && image != null) {
        out = new ByteArrayOutputStream();
        Graphics2D g = image.createGraphics();
        g.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
        g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

        try {
            int size = 40;
            Font font = new Font(Font.SANS_SERIF, Font.BOLD, size);
            FontMetrics metrics = g.getFontMetrics(font);
            while (size > 7 && metrics.stringWidth(label) > 135) {
                size--;
                font = new Font(Font.SANS_SERIF, Font.BOLD, size);
                metrics = g.getFontMetrics(font);
            }
            // Text center point 127x, 49y - calculate centering coordinates
            int x = 127 - metrics.stringWidth(label) / 2;
            int y = 46 + metrics.getAscent() / 2;
            g.drawImage(image, 0, 0, null);
            g.setColor(Color.WHITE);
            g.setFont(font);
            g.drawString(label, x, y);

            ImageIO.setUseCache(false);
            ImageIOTools.imageIOWrite(image, imageFormat.toString(), out);
        } finally {
            g.dispose();
        }
    }
    return out != null ? DLNAThumbnail.toThumbnail(out.toByteArray(), 0, 0, ScaleType.MAX, imageFormat, false)
            : null;
}

From source file:piramide.interaction.reasoner.FuzzyReasonerWizardFacade.java

private BufferedImage createErrorMessagesImage(String text) {
    final Font font = TextTitle.DEFAULT_FONT;
    final Font bigBold = new Font(font.getName(), Font.BOLD, 24);
    final FontRenderContext frc = new FontRenderContext(null, true, false);
    final TextLayout layout = new TextLayout(text, bigBold, frc);
    final Rectangle2D bounds = layout.getBounds();
    final int w = (int) Math.ceil(bounds.getWidth());
    final int h = (int) Math.ceil(bounds.getHeight());
    final BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    final Graphics2D g = image.createGraphics();
    g.setColor(Color.WHITE);//from   w ww  . ja v  a2  s. c  o  m
    g.fillRect(0, 0, w, h);
    g.setColor(Color.RED);
    g.setFont(bigBold);
    g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
    g.drawString(text, (float) -bounds.getX(), (float) -bounds.getY());
    g.dispose();
    return image;
}

From source file:com.AandR.beans.plotting.LinePlotPanel.LinePlotPanel.java

private ChartPanel createChartPanel() {
    JFreeChart xyChart = ChartFactory.createXYLineChart("f", "x", "y", plotSeries, PlotOrientation.VERTICAL,
            false, true, false);/*from   w  w  w.  j  a  v  a 2 s  .  c  o  m*/
    RenderingHints hints = xyChart.getRenderingHints();
    hints.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    xyChart.setBackgroundPaint(Color.WHITE);

    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyChart.getXYPlot().getRenderer();
    renderer.setBaseLinesVisible(isLineVisible);
    renderer.setBaseShapesVisible(isSymbolVisible);

    LegendTitle legend = new LegendTitle(renderer);
    legend.setPosition(RectangleEdge.BOTTOM);
    xyChart.addLegend(legend);

    xyChart.getXYPlot().getRangeAxis().setStandardTickUnits(createTickUnits());
    //xyChart.getXYPlot().getRangeAxis().setStandardTickUnits(new StandardTickUnitSource());
    xyChart.getXYPlot().getRangeAxis().setAutoRangeMinimumSize(1.0e-45);

    chartPanel = new ChartPanel(xyChart);

    JPopupMenu popup = chartPanel.getPopupMenu();
    popup.remove(1); // removes separator
    popup.remove(1); // removes save as...
    popup.add(createLinePropMenu());
    popup.add(createAxesPropMenu());
    popup.addSeparator();
    popup.add(createExportMenu());
    return chartPanel;
}

From source file:weka.core.ChartUtils.java

/**
 * Render a combined histogram and pie chart from summary data
 * /*from ww w  .  j a v  a  2s  . c o m*/
 * @param width the width of the resulting image
 * @param height the height of the resulting image
 * @param values the values for the chart
 * @param freqs the corresponding frequencies
 * @param additionalArgs optional arguments to the renderer (may be null)
 * @return a buffered image
 * @throws Exception if a problem occurs
 */
public static BufferedImage renderCombinedPieAndHistogramFromSummaryData(int width, int height,
        List<String> values, List<Double> freqs, List<String> additionalArgs) throws Exception {

    String plotTitle = "Combined Chart";
    String userTitle = getOption(additionalArgs, "-title");
    plotTitle = (userTitle != null) ? userTitle : plotTitle;

    List<String> opts = new ArrayList<String>();
    opts.add("-title=distribution");
    BufferedImage pie = renderPieChartFromSummaryData(width / 2, height, values, freqs, false, true, opts);

    opts.clear();
    opts.add("-title=histogram");
    BufferedImage hist = renderHistogramFromSummaryData(width / 2, height, values, freqs, opts);

    BufferedImage img = new BufferedImage(width, height + 20, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2d = img.createGraphics();
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
    g2d.setFont(new Font("SansSerif", Font.BOLD, 12));
    g2d.setColor(Color.lightGray);
    g2d.fillRect(0, 0, width, height + 20);
    g2d.setColor(Color.black);
    FontMetrics fm = g2d.getFontMetrics();
    int fh = fm.getHeight();
    int sw = fm.stringWidth(plotTitle);

    g2d.drawImage(pie, 0, 20, null);
    g2d.drawImage(hist, width / 2 + 1, 20, null);
    g2d.drawString(plotTitle, width / 2 - sw / 2, fh + 2);
    g2d.dispose();

    return img;
}

From source file:com.github.lucapino.sheetmaker.renderer.JavaTemplateRenderer.java

private void processTextElement(Graphics2D g2, Element textElement) {

    int x = Integer.valueOf(textElement.getAttributeValue("X"));
    int y = Integer.valueOf(textElement.getAttributeValue("Y"));
    int width = Integer.valueOf(textElement.getAttributeValue("Width"));
    int height = Integer.valueOf(textElement.getAttributeValue("Height"));
    String alignment = textElement.getAttributeValue("TextAlignment");
    boolean multiline = Boolean.valueOf(textElement.getAttributeValue("Multiline").toLowerCase());
    boolean antiAlias = textElement.getAttributeValue("TextQuality").equalsIgnoreCase("antialias");

    Font font = parseFont(textElement.getAttributeValue("Font"));

    logger.info("Using font " + font);
    // now get the textim4java performance
    String text = textElement.getAttributeValue("Text");
    // if text matches pattern of %VARIABLE%{MODIFIER}
    logger.info("parsing token {}", text);
    Matcher matcher = pattern.matcher(text);
    int start = 0;
    while (matcher.find(start)) {
        // apply modification
        text = text.replace(matcher.group(), applyModifier(matcher.group()));
        start = matcher.end();/*from   www  .ja v  a  2  s . c  o m*/
    }
    BufferedImage tmpImage;
    if (width > 0 && height > 0) {
        // create a transparent tmpImage
        tmpImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
    } else {
        FontMetrics fm = g2.getFontMetrics(font);
        Rectangle outlineBounds = fm.getStringBounds(text, g2).getBounds();
        //         we need to create a transparent image to paint
        tmpImage = new BufferedImage(outlineBounds.width, outlineBounds.height, BufferedImage.TYPE_INT_ARGB);
    }
    Graphics2D g2d = tmpImage.createGraphics();
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
    //        }
    g2d.setFont(font);
    Color textColor = new Color(Integer.valueOf(textElement.getAttributeValue("ForeColor")));
    g2d.setColor(textColor);
    Composite comp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .8f);
    g2d.setComposite(comp);
    drawString(g2d, text, new Rectangle(0, 0, width, height), Align.valueOf(alignment), 0, multiline);
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
    tmpImage = processActions(textElement, tmpImage);

    ////        Graphics2D g2d = tmpImage.createGraphics();
    //        // set current font
    //        g2.setFont(font);
    ////        g2d.setComposite(AlphaComposite.Clear);
    ////        g2d.fillRect(0, 0, width, height);
    ////        g2d.setComposite(AlphaComposite.Src);
    //        // TODO: we have to parse it
    //        int strokeWidth = Integer.valueOf(textElement.getAttributeValue("StrokeWidth"));
    //        // the color of the outline
    //        if (strokeWidth > 0) {
    ////            Color strokeColor = new Color(Integer.valueOf(textElement.getAttributeValue("StrokeColor")));
    ////            AffineTransform affineTransform;
    ////            affineTransform = g2d.getTransform();
    ////            affineTransform.translate(width / 2 - (outlineBounds.width / 2), height / 2
    ////                    + (outlineBounds.height / 2));
    ////            g2d.transform(affineTransform);
    ////            // backup stroke width and color
    ////            Stroke originalStroke = g2d.getStroke();
    ////            Color originalColor = g2d.getColor();
    ////            g2d.setColor(strokeColor);
    ////            g2d.setStroke(new BasicStroke(strokeWidth));
    ////            g2d.draw(shape);
    ////            g2d.setClip(shape);
    ////            // restore stroke width and color
    ////            g2d.setStroke(originalStroke);
    ////            g2d.setColor(originalColor);
    //        }
    ////        // get the text color
    //        Color textColor = new Color(Integer.valueOf(textElement.getAttributeValue("ForeColor")));
    //        g2.setColor(textColor);
    ////        g2d.setBackground(Color.BLACK);
    ////        g2d.setStroke(new BasicStroke(2));
    ////        g2d.setColor(Color.WHITE);
    //        // draw the text
    //
    //        drawString(g2, text, new Rectangle(x, y, width, height), Align.valueOf(alignment), 0, multiline);
    //        g2.drawString(text, x, y);
    //        Rectangle rect = new Rectangle(x, y, width, height); // defines the desired size and position
    //        FontMetrics fm = g2.getFontMetrics();
    //        FontRenderContext frc = g2.getFontRenderContext();
    //        TextLayout tl = new TextLayout(text, g2.getFont(), frc);
    //        AffineTransform transform = new AffineTransform();
    //        transform.setToTranslation(rect.getX(), rect.getY());
    //        if (Boolean.valueOf(textElement.getAttributeValue("AutoSize").toLowerCase())) {
    //            double scaleY
    //                    = rect.getHeight() / (double) (tl.getOutline(null).getBounds().getMaxY()
    //                    - tl.getOutline(null).getBounds().getMinY());
    //            transform.scale(rect.getWidth() / (double) fm.stringWidth(text), scaleY);
    //        }
    //        Shape shape = tl.getOutline(transform);
    //        g2.setClip(shape);
    //        g2.fill(shape.getBounds());
    //        if (antiAlias) {
    // we need to restore antialias to none
    //            g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
    //        }
    //        g2.drawString(text, x, y);
    // alway resize
    //        BicubicScaleFilter scaleFilter = new BicubicScaleFilter(width, height);
    //        tmpImage = scaleFilter.filter(tmpImage, null);
    // draw the image to the source
    g2.drawImage(tmpImage, x, y, width, height, null);
    try {
        ScreenImage.writeImage(tmpImage, "/tmp/images/" + textElement.getAttributeValue("Name") + ".png");
    } catch (IOException ex) {

    }

}

From source file:weka.core.ChartUtils.java

/**
 * Render a combined histogram and box plot chart from summary data
 * /*from ww  w .  j  a  v a  2  s .  co  m*/
 * @param width the width of the resulting image
 * @param height the height of the resulting image
 * @param bins the values for the chart
 * @param freqs the corresponding frequencies
 * @param summary the summary stats for the box plot
 * @param outliers an optional list of outliers for the box plot
 * @param additionalArgs optional arguments to the renderer (may be null)
 * @return a buffered image
 * @throws Exception if a problem occurs
 */
public static BufferedImage renderCombinedBoxPlotAndHistogramFromSummaryData(int width, int height,
        List<String> bins, List<Double> freqs, List<Double> summary, List<Double> outliers,
        List<String> additionalArgs) throws Exception {

    String plotTitle = "Combined Chart";
    String userTitle = getOption(additionalArgs, "-title");
    plotTitle = (userTitle != null) ? userTitle : plotTitle;

    List<String> opts = new ArrayList<String>();
    opts.add("-title=histogram");
    BufferedImage hist = renderHistogramFromSummaryData(width / 2, height, bins, freqs, opts);
    opts.clear();
    opts.add("-title=box plot");
    BufferedImage box = null;
    try {
        box = renderBoxPlotFromSummaryData(width / 2, height, summary, outliers, opts);
    } catch (Exception ex) {
        // if we can't generate the box plot (i.e. probably because
        // data is 100% missing) then just return the histogram
    }

    if (box == null) {
        width /= 2;
    }
    BufferedImage img = new BufferedImage(width, height + 20, BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2d = img.createGraphics();
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP);
    g2d.setFont(new Font("SansSerif", Font.BOLD, 12));
    g2d.setColor(Color.lightGray);
    g2d.fillRect(0, 0, width, height + 20);
    g2d.setColor(Color.black);
    FontMetrics fm = g2d.getFontMetrics();
    int fh = fm.getHeight();
    int sw = fm.stringWidth(plotTitle);

    if (box != null) {
        g2d.drawImage(box, 0, 20, null);
        g2d.drawImage(hist, width / 2 + 1, 20, null);
    } else {
        g2d.drawImage(hist, 0, 20, null);
    }
    g2d.drawString(plotTitle, width / 2 - sw / 2, fh + 2);
    g2d.dispose();

    return img;
}

From source file:web.diva.server.model.SomClustering.SomClustImgGenerator.java

public void drawTable(Graphics gr, Point UL, Dataset dataset, int[] selection, Graphics navgGr,
        int countNavUnit) {

    Font f = getTableFont(squareL - 1);
    AnnotationManager annManager = AnnotationManager.getAnnotationManager();
    String[] rowIds = dataset.getRowIds();

    Set<String> annotations = dataset.getRowAnnotationNamesInUse();
    if (annotations == null) {
        annotations = annManager.getManagedRowAnnotationNames();
    }// w  w w  .ja v a2s.  co m

    String[][] inf; // row annotation matrix
    String[] headers; // header of the row annotation matrix
    if (annotations.isEmpty()) {
        inf = new String[dataset.getDataLength()][1];
        for (int i = 0; i < inf.length; i++) {
            inf[i][0] = rowIds[i];
        }
        headers = new String[] { "Row ID" };
    } else {
        headers = annotations.toArray(new String[annotations.size()]);
        inf = new String[dataset.getDataLength()][annotations.size()];
        for (int i = 0; i < headers.length; i++) {
            //ann manager need to re implemeinted?
            AnnotationLibrary anns = annManager.getRowAnnotations(headers[i]);
            for (int j = 0; j < inf.length; j++) {
                inf[j][i] = rowIds[j];//anns.getAnnotation(rowIds[j]);//
            }
        }
    }

    Graphics2D g2d = (Graphics2D) gr;
    Graphics2D g2dNav = (Graphics2D) navgGr;
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    g2dNav.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

    int X = UL.x;
    int Y = UL.y;
    //        int H = squareL;

    int L = dataset.getDataLength();
    int W = headers.length;

    JLabel l = new JLabel("    ");
    JLabel lNav = new JLabel(" ");
    //        l.setFont(f);
    //        l.setIconTextGap(2);
    javax.swing.border.Border UB = javax.swing.BorderFactory.createMatteBorder(0, 0, 0, 0, Color.WHITE);
    javax.swing.border.Border LB = javax.swing.BorderFactory.createMatteBorder(0, 0, 0, 0, Color.WHITE);

    //          Color borderColor = hex2Rgb("#e3e3e3");
    javax.swing.border.Border navBorder = javax.swing.BorderFactory.createMatteBorder(2, 0, 0, 0, Color.WHITE);

    l.setMaximumSize(new Dimension(200, squareL));
    lNav.setSize(new Dimension(2, 5));
    lNav.setBorder(navBorder);

    boolean drawTableHeader = false;

    //if there is not enough room for a header.. skip header.
    //        if (UL.y < squareL) {
    //            drawTableHeader = false;
    //        }

    if (Wd == null) {
        Wd = new int[inf[0].length];
        WdSUM = new int[inf[0].length];

        if (drawTableHeader) {
            for (int i = 0; i < headers.length; i++) {
                l.setText(headers[i]);
                l.validate();
                if (l.getPreferredSize().width > Wd[i]) {
                    Wd[i] = l.getPreferredSize().width + 16;
                }
            }
        }
        for (String[] inf1 : inf) {
            for (int j = 0; j < Wd.length; j++) {
                if (squareL < 6) {
                    Wd[j] = 5;
                    continue;
                }
                l.setText(inf1[j]);
                l.validate();
                if (l.getPreferredSize().width > Wd[j]) {
                    Wd[j] = l.getPreferredSize().width + 16;
                }
            }
        }

        WdSUM[0] = 0;

        for (int i = 0; i < Wd.length; i++) {
            WdSUM[i] = -1;
            for (int j = 0; j < i; j++) {
                WdSUM[i] += Wd[j] + 3;
            }
        }
    }

    Rectangle BNDS = new Rectangle();

    l.setBackground(Color.WHITE);
    l.setOpaque(true);

    lNav.setBackground(Color.WHITE);
    lNav.setOpaque(true);

    if (sideTree == null) {
        return;
    }

    f = getTableFont(squareL - 1);
    l.setFont(f);

    int[] LArr = sideTree.arrangement;
    int Rindex = 0;

    //draw the table header.. (if wanted)
    //        if (drawTableHeader) {
    //
    //            l.setBackground(Color.WHITE);
    //            l.setForeground(Color.white);
    //
    //            for (int j = 0; j < W; j++) {
    //                X = UL.x + WdSUM[j];
    //                Y = UL.y;
    //                BNDS.setBounds(X, Y, Wd[j], squareL + 1);
    //
    //                if (gr.getClipBounds() != null && !gr.getClipBounds().intersects(BNDS)) {
    //                    continue;
    //                }
    //                gr.translate(X, Y);
    //                l.setBounds(0, 0, Wd[j] + 1, squareL + 1);
    //                l.setBorder(LB);
    //
    //                if (squareL >= 6) {
    //                    l.setText(headers[j]);
    //                }
    //                l.validate();
    //                l.paint(gr);
    //                gr.translate(-X, -Y);
    //            }
    //        }
    l.setForeground(Color.WHITE);

    boolean[] sel = selectedRows((selection == null ? null : selection), dataset);
    boolean coloredNav = false;
    int navCounter = 0;
    for (int i = 0; i < L; i++) {

        Rindex = LArr[i];
        for (int j = 0; j < W; j++) {
            X = UL.x + WdSUM[j];
            Y = UL.y + (squareL * (i + 1));

            BNDS.setBounds(X, Y, Wd[j], squareL + 1);

            if (gr.getClipBounds() != null && !gr.getClipBounds().intersects(BNDS)) {
                continue;
            }

            if (sel[LArr[i]]) {

                for (Group group : dataset.getRowGroups()) {
                    if (group.isActive()) {
                        if (group.hasMember(Rindex)) {
                            l.setBackground(group.getColor());
                            if (!coloredNav) {
                                lNav.setBackground(Color.RED);
                                lNav.setForeground(Color.RED);
                                coloredNav = true;
                            }

                            break;

                        }
                    }

                }

                //                    l.setBackground(new Color(225, 225, 255));
            } else {
                //                   
                //                    if (!coloredNav) {
                //                                    lNav.setBackground(Color.WHITE);
                //                                    lNav.setForeground(Color.WHITE);                                  
                //                                }

                l.setBackground(Color.WHITE);
            }
            if (i != 0)
                gr.translate(X, Y);
            l.setBounds(0, 0, Wd[j] + 1, squareL + 1);

            if (i < L - 1) {
                l.setBorder(UB);
            } else {
                l.setBounds(0, 0, Wd[j] + 1, squareL + 1);
                l.setBorder(LB);
            }
            if (squareL >= 6) {
                l.setText(inf[Rindex][j]);
            }
            l.validate();
            l.paint(gr);
            gr.translate(-X, -Y);

        }
        if (navCounter >= countNavUnit) {
            navCounter = 0;
            lNav.validate();
            lNav.paint(navgGr);
            navgGr.translate(2, 0);
            coloredNav = false;
            lNav.setBackground(Color.WHITE);
            lNav.setForeground(Color.WHITE);

        }
        navCounter++;
    }

    //        if (squareL < 6) {
    //            return;
    //        }
    //
    //        l.setBackground(Color.WHITE);
    //        f = getTableFont(squareL - 2);
    //        //f = new Font("Arial",1,squareL-2);
    //        l.setFont(f);
    //
    //
    //        for (int j = 0; j < W; j++) {
    //            X = UL.x + WdSUM[j];
    //            Y = UL.y;
    //
    //            BNDS.setBounds(X, Y, Wd[j], squareL + 1);
    //            if (gr.getClipBounds() != null && !gr.getClipBounds().intersects(BNDS)) {
    //                continue;
    //            }
    //
    //            gr.translate(X, Y);
    //            l.setBounds(0, 0, Wd[j], squareL + 1);
    ////            l.setBorder(javax.swing.BorderFactory.createLineBorder(GridCol));
    //            l.setText(headers[j]);
    //            l.validate();
    //            gr.translate(-X, -Y);
    //        }

}