borland Packages Class Hierarchy dbswing Package
java.lang.Object +----com.borland.dbswing.TableHeaderRenderer
Properties Methods
Implements Serializable, TableCellRenderer
TableHeaderRenderer
can be used in place of a TableColumn's
default header renderer to display multi-line column headers. Note that because this renderer maintains state information, a single instance cannot be reused as the renderer for multiple TableColumn
objects. This renderer also assumes that once its value has ben set, it is unlikely to change and tries to take advantage of this assumption to achieve better performance.
Because TableColumn.setHeaderValue()
takes an Object
as its parameter, you have the option of passing a String
containing newline characters ('\n') to it, or an array of String
objects. Because passing an array is more efficient, consider this option if possible. TableHeaderRenderer
is used internally by JdbTable
whenever there is a header which consists of either an array of Strings
or a String
containing newline characters.
// specify JdbHeader as the first column's renderer jTable.getColumnModel().getColumn(0).setHeaderRenderer(new TableHeaderRenderer()); // specify a multi-line column header jTable.getColumnModel().getColumn(1).setHeaderValue(new String[]{"Line1", "Line2"});