Java JTable Cell renderHTMLCell(final StringBuffer buffer, final String contents, final String css, final int align)

Here you can find the source of renderHTMLCell(final StringBuffer buffer, final String contents, final String css, final int align)

Description

Render a single table cell in HTML with an optional style.

License

Open Source License

Parameter

Parameter Description
buffer a parameter
contents a parameter
css a parameter
align a parameter

Declaration


public synchronized static void renderHTMLCell(final StringBuffer buffer, final String contents,
        final String css, final int align) 

Method Source Code


//package com.java2s;
// it under the terms of the GNU General Public License as published by

import javax.swing.*;

public class Main {
    public static final String CR_LF = "\r\n";
    private static final String ALIGN_LEFT = "left";
    private static final String ALIGN_RIGHT = "right";
    private static final String ALIGN_CENTER = "center";

    /***********************************************************************************************
     * Render a single table cell in HTML with an optional style.
     */*from   w  w  w . ja va  2s  . c  om*/
     * @param buffer
     * @param contents
     * @param css
     * @param align
     */

    public synchronized static void renderHTMLCell(final StringBuffer buffer, final String contents,
            final String css, final int align) {
        String strAlign;

        strAlign = ALIGN_LEFT;

        if (align == SwingConstants.LEFT) {
            strAlign = ALIGN_LEFT;
        } else if (align == SwingConstants.RIGHT) {
            strAlign = ALIGN_RIGHT;
        } else if (align == SwingConstants.CENTER) {
            strAlign = ALIGN_CENTER;
        }

        buffer.append("<td");
        buffer.append(css);
        buffer.append(" align=");
        buffer.append(strAlign);
        buffer.append(">");
        buffer.append(CR_LF);
        buffer.append(contents);
        buffer.append(CR_LF);
        buffer.append("</td>");
        buffer.append(CR_LF);
    }
}

Related

  1. getIntercellWidth(JTable table)
  2. getTableFocusCellForeground()
  3. getWidestCellInColumn(JTable table, TableColumn col)
  4. getWidestCellInColumn(TableColumn col, JTable table)
  5. isCellVisible(JTable table, int rowIndex, int vColIndex)
  6. setCellTextAllignment(JTable table, int alignment)
  7. showCell(JTable table, int row, int column)
  8. showCell(JTable table, int row, int column)
  9. startEditingAtCell(JTable table, int row, int column)