Java Code Examples for javax.swing.table.JTableHeader#getFont()

The following examples show how to use javax.swing.table.JTableHeader#getFont() . 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: TimelineHeaderRenderer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static void initStaticUI(Component c, JTableHeader header) {
    painter = new LabelRenderer(true);
    
    Color color = c.getForeground();
    if (color == null) color = header.getForeground();
    if (color == null) color = UIManager.getColor("TableHeader.foreground"); // NOI18N
    if (color != null) painter.setForeground(color);
    Font font = c.getFont();
    if (font == null) font = header.getFont();
    if (font == null) font = UIManager.getFont("TableHeader.font"); // NOI18N
    if (font != null) painter.setFont(font);
    
    if (UIUtils.isWindowsXPLookAndFeel()) Y_LAF_OFFSET = 1;
    else if (UIUtils.isNimbusLookAndFeel()) Y_LAF_OFFSET = -1;
    else Y_LAF_OFFSET = 0;
}
 
Example 2
Source File: TimelineHeaderRenderer.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
private static void initStaticUI(Component c, JTableHeader header) {
    painter = new LabelRenderer(true);
    
    Color color = c.getForeground();
    if (color == null) color = header.getForeground();
    if (color == null) color = UIManager.getColor("TableHeader.foreground"); // NOI18N
    if (color != null) painter.setForeground(color);
    Font font = c.getFont();
    if (font == null) font = header.getFont();
    if (font == null) font = UIManager.getFont("TableHeader.font"); // NOI18N
    if (font != null) painter.setFont(font);
    
    if (UIUtils.isWindowsXPLookAndFeel()) Y_LAF_OFFSET = 1;
    else if (UIUtils.isNimbusLookAndFeel()) Y_LAF_OFFSET = -1;
    else Y_LAF_OFFSET = 0;
}
 
Example 3
Source File: RowHeaderRenderer.java    From ramus with GNU General Public License v3.0 5 votes vote down vote up
RowHeaderRenderer(final JTable table) {
    this.table = table;
    normalBorder = UIManager.getBorder("TableHeader.cellBorder");
    selectedBorder = BorderFactory.createRaisedBevelBorder();
    final JTableHeader header = table.getTableHeader();
    normalFont = header.getFont();
    selectedFont = normalFont.deriveFont(normalFont.getStyle() | Font.BOLD);
    setForeground(header.getForeground());
    setBackground(header.getBackground());
    setOpaque(true);
}
 
Example 4
Source File: RowHeaderRenderer.java    From nextreports-designer with Apache License 2.0 5 votes vote down vote up
RowHeaderRenderer(JTable table) {
    this.table = table;
    // this needs to be updated if the LaF changes
    normalBorder = UIManager.getBorder("TableHeader.cellBorder");
    selectedBorder = BorderFactory.createRaisedBevelBorder();
    final JTableHeader header = this.table.getTableHeader();
    normalFont = header.getFont();
    selectedFont = normalFont.deriveFont(normalFont.getStyle() | Font.BOLD);
    setForeground(header.getForeground());
    setBackground(header.getBackground());
    setOpaque(true);
    setHorizontalAlignment(CENTER);
}
 
Example 5
Source File: FormattedTable.java    From azure-devops-intellij with MIT License 4 votes vote down vote up
/**
 * Customize column headers
 */
public void customizeHeader() {
    final JTableHeader header = getTableHeader();
    final Font headerFont = header.getFont();
    getTableHeader().setFont(new Font(headerFont.getFontName(), Font.BOLD, headerFont.getSize()));
}