Java Code Examples for javax.swing.table.DefaultTableCellRenderer#setPreferredSize()

The following examples show how to use javax.swing.table.DefaultTableCellRenderer#setPreferredSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JTableUtil.java    From MooTool with MIT License 5 votes vote down vote up
/**
 * 隐藏表头
 *
 * @param table
 */
public static void hideTableHeader(JTable table) {
    table.getTableHeader().setVisible(false);
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setPreferredSize(new Dimension(0, 0));
    table.getTableHeader().setDefaultRenderer(renderer);
}
 
Example 2
Source File: JTableUtil.java    From WePush with MIT License 5 votes vote down vote up
/**
 * 隐藏表头
 *
 * @param table
 */
public static void hideTableHeader(JTable table) {
    table.getTableHeader().setVisible(false);
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setPreferredSize(new Dimension(0, 0));
    table.getTableHeader().setDefaultRenderer(renderer);
}