src/main/java/com/mxgraph/util/mxUtils.java
public static Element createTable(Document document, String text, int x,
			int y, int w, int h, double scale, Map<String, Object> style)
	{
		// Does not use a textbox as this must go inside another VML shape
		Element table = document.createElement("table");

		if (text != null && text.length() > 0)
		{
			Element tr = document.createElement("tr");
			Element td = document.createElement("td");

			table.setAttribute("cellspacing", "0");
			table.setAttribute("border", "0");
			td.setAttribute("align", mxUtils.getString(style,
					mxConstants.STYLE_ALIGN, mxConstants.ALIGN_CENTER));

			String fontColor = getString(style, mxConstants.STYLE_FONTCOLOR,
					"black");
			String fontFamily = getString(style, mxConstants.STYLE_FONTFAMILY,
					mxConstants.DEFAULT_FONTFAMILIES);
			int fontSize = (int) (getInt(style, mxConstants.STYLE_FONTSIZE,
					mxConstants.DEFAULT_FONTSIZE) * scale);

			String s = "position:absolute;" + "left:" + String.valueOf(x)
					+ "px;" + "top:" + String.valueOf(y) + "px;" + "width:"
					+ String.valueOf(w) + "px;" + "height:" + String.valueOf(h)
					+ "px;" + "font-size:" + String.valueOf(fontSize) + "px;"
					+ "font-family:" + fontFamily + ";" + "color:" + fontColor
					+ ";";

			if (mxUtils.getString(style, mxConstants.STYLE_WHITE_SPACE,
					"nowrap").equals("wrap"))
			{
				s += "white-space:normal;";
			}

			// Applies the background color
			String background = getString(style,
					mxConstants.STYLE_LABEL_BACKGROUNDCOLOR);

			if (background != null)
			{
				s += "background:" + background + ";";
			}

			// Applies the border color
			String border = getString(style,
					mxConstants.STYLE_LABEL_BORDERCOLOR);

			if (border != null)
			{
				s += "border:" + border + " solid 1pt;";
			}

			// Applies the opacity
			float opacity = getFloat(style, mxConstants.STYLE_TEXT_OPACITY, 100);

			if (opacity < 100)
			{
				// Adds all rules (first for IE)
				s += "filter:alpha(opacity=" + opacity + ");";
				s += "opacity:" + (opacity / 100) + ";";
			}

			td.setAttribute("style", s);
			String[] lines = text.split("\n");

			for (int i = 0; i < lines.length; i++)
			{
				td.appendChild(document.createTextNode(lines[i]));
				td.appendChild(document.createElement("br"));
			}

			tr.appendChild(td);
			table.appendChild(tr);
		}

		return table;
	}
/**
	 * Creates a table for the given text using the given document to create the
	 * DOM nodes. Returns the outermost table node.
	 */
Creates a table for the given text using the given document to create the
DOM nodes. Returns the outermost table node.
Creates a table for the given text using the given document to create the DOM nodes . Returns the outermost table node .
public static Element createTable(Document document, String text, int x,
			int y, int w, int h, double scale, Map<String, Object> style)
	{
		Element table = document.createElement("table");
		if (text != null && text.length() > 0)
		{
			Element tr = document.createElement("tr");
			Element td = document.createElement("td");
			table.setAttribute("cellspacing", "0");
			table.setAttribute("border", "0");
			td.setAttribute("align", mxUtils.getString(style,
					mxConstants.STYLE_ALIGN, mxConstants.ALIGN_CENTER));
			String fontColor = getString(style, mxConstants.STYLE_FONTCOLOR,
					"black");
			String fontFamily = getString(style, mxConstants.STYLE_FONTFAMILY,
					mxConstants.DEFAULT_FONTFAMILIES);
			int fontSize = (int) (getInt(style, mxConstants.STYLE_FONTSIZE,
					mxConstants.DEFAULT_FONTSIZE) * scale);
			String s = "position:absolute;" + "left:" + String.valueOf(x)
					+ "px;" + "top:" + String.valueOf(y) + "px;" + "width:"
					+ String.valueOf(w) + "px;" + "height:" + String.valueOf(h)
					+ "px;" + "font-size:" + String.valueOf(fontSize) + "px;"
					+ "font-family:" + fontFamily + ";" + "color:" + fontColor
					+ ";";
			if (mxUtils.getString(style, mxConstants.STYLE_WHITE_SPACE,
					"nowrap").equals("wrap"))
			{
				s += "white-space:normal;";
			}
			String background = getString(style,
					mxConstants.STYLE_LABEL_BACKGROUNDCOLOR);
			if (background != null)
			{
				s += "background:" + background + ";";
			}
			String border = getString(style,
					mxConstants.STYLE_LABEL_BORDERCOLOR);
			if (border != null)
			{
				s += "border:" + border + " solid 1pt;";
			}
			float opacity = getFloat(style, mxConstants.STYLE_TEXT_OPACITY, 100);
			if (opacity < 100)
			{
				s += "filter:alpha(opacity=" + opacity + ");";
				s += "opacity:" + (opacity / 100) + ";";
			}
			td.setAttribute("style", s);
			String[] lines = text.split("\n");
			for (int i = 0; i < lines.length; i++)
			{
				td.appendChild(document.createTextNode(lines[i]));
				td.appendChild(document.createElement("br"));
			}
			tr.appendChild(td);
			table.appendChild(tr);
		}
		return table;
	}
public static Element createTable ( Document document , String text , int x , int y , int w , int h , double scale , Map < String , Object > style ) { Element table = document . createElement ( "table" ) ; if ( text != null && text . length ( ) > 0 ) { Element tr = document . createElement ( "tr" ) ; Element td = document . createElement ( "td" ) ; table . setAttribute ( "cellspacing" , "0" ) ; table . setAttribute ( "border" , "0" ) ; td . setAttribute ( "align" , mxUtils . getString ( style , mxConstants . STYLE_ALIGN , mxConstants . ALIGN_CENTER ) ) ; String fontColor = getString ( style , mxConstants . STYLE_FONTCOLOR , "black" ) ; String fontFamily = getString ( style , mxConstants . STYLE_FONTFAMILY , mxConstants . DEFAULT_FONTFAMILIES ) ; int fontSize = ( int ) ( getInt ( style , mxConstants . STYLE_FONTSIZE , mxConstants . DEFAULT_FONTSIZE ) * scale ) ; String s = "position:absolute;" + "left:" + String . valueOf ( x ) + "px;" + "top:" + String . valueOf ( y ) + "px;" + "width:" + String . valueOf ( w ) + "px;" + "height:" + String . valueOf ( h ) + "px;" + "font-size:" + String . valueOf ( fontSize ) + "px;" + "font-family:" + fontFamily + ";" + "color:" + fontColor + ";" ; if ( mxUtils . getString ( style , mxConstants . STYLE_WHITE_SPACE , "nowrap" ) . equals ( "wrap" ) ) { s += "white-space:normal;" ; } String background = getString ( style , mxConstants . STYLE_LABEL_BACKGROUNDCOLOR ) ; if ( background != null ) { s += "background:" + background + ";" ; } String border = getString ( style , mxConstants . STYLE_LABEL_BORDERCOLOR ) ; if ( border != null ) { s += "border:" + border + " solid 1pt;" ; } float opacity = getFloat ( style , mxConstants . STYLE_TEXT_OPACITY , 100 ) ; if ( opacity < 100 ) { s += "filter:alpha(opacity=" + opacity + ");" ; s += "opacity:" + ( opacity / 100 ) + ";" ; } td . setAttribute ( "style" , s ) ; String [ ] lines = text . split ( "\n" ) ; for ( int i = 0 ; i < lines . length ; i ++ ) { td . appendChild ( document . createTextNode ( lines [ i ] ) ) ; td . appendChild ( document . createElement ( "br" ) ) ; } tr . appendChild ( td ) ; table . appendChild ( tr ) ; } return table ; }
Creates a table for the given text using the given document to create the
 DOM nodes.
Creates a table for the given text using the given document to create the DOM nodes .
// Does not use a textbox as this must go inside another VML shape // Applies the background color // Applies the border color // Applies the opacity // Adds all rules (first for IE)