private void setColumnPreferredSize() {
   for (int i = 0; i < getColumnCount(); i++) {
     TableColumn column = getColumnModel().getColumn(i);
     if (i == AbstractVcsLogTableModel.ROOT_COLUMN) { // thin stripe or nothing
       int rootWidth = myUI.getColorManager().isMultipleRoots() ? ROOT_INDICATOR_WIDTH : 0;
       // NB: all further instructions and their order are important, otherwise the minimum size
       // which is less than 15 won't be applied
       column.setMinWidth(rootWidth);
       column.setMaxWidth(rootWidth);
       column.setPreferredWidth(rootWidth);
     } else if (i
         == AbstractVcsLogTableModel
             .COMMIT_COLUMN) { // let commit message occupy as much as possible
       column.setPreferredWidth(Short.MAX_VALUE);
     } else if (i
         == AbstractVcsLogTableModel.AUTHOR_COLUMN) { // detect author with the longest name
       int contentWidth = calcMaxContentColumnWidth(i, 1000);
       column.setMinWidth(Math.min(contentWidth, MAX_DEFAULT_AUTHOR_COLUMN_WIDTH));
       column.setWidth(column.getMinWidth());
     } else if (i == AbstractVcsLogTableModel.DATE_COLUMN) { // all dates have nearly equal sizes
       Font tableFont = UIManager.getFont("Table.font");
       column.setMinWidth(
           getFontMetrics(tableFont)
               .stringWidth("mm" + DateFormatUtil.formatDateTime(new Date())));
       column.setWidth(column.getMinWidth());
     }
   }
 }
  @Override
  public int getRowHeight() {
    if (myRowHeightIsComputing) {
      return super.getRowHeight();
    }

    if (myRowHeight < 0) {
      try {
        myRowHeightIsComputing = true;
        for (int row = 0; row < getRowCount(); row++) {
          for (int column = 0; column < getColumnCount(); column++) {
            final TableCellRenderer renderer = getCellRenderer(row, column);
            if (renderer != null) {
              final Object value = getValueAt(row, column);
              final Component component =
                  renderer.getTableCellRendererComponent(this, value, true, true, row, column);
              if (component != null) {
                final Dimension size = component.getPreferredSize();
                myRowHeight = Math.max(size.height, myRowHeight);
              }
            }
          }
        }
      } finally {
        myRowHeightIsComputing = false;
      }
    }

    if (myMinRowHeight == null) {
      myMinRowHeight = getFontMetrics(UIManager.getFont("Label.font")).getHeight();
    }

    return Math.max(myRowHeight, myMinRowHeight);
  }
  /** Set the font used to display today's date as text. */
  protected void setupTodayFont() {
    Font font;
    if (todaysLabel == null) return;

    // If not null, use what the user gave us

    if (todayFont != null) {
      todaysLabel.setFont(todayFont);
    } else {
      font = UIManager.getFont("Label.font");
      todaysLabel.setFont(font);
    }
  }
  /** Set the time spinner's font. */
  protected void setupTimeFont() {
    Font font;
    if (spinner == null) return;

    // If not null, use what the user gave us

    if (timeFont != null) {
      spinner.setFont(timeFont);
    } else {
      font = UIManager.getFont("Spinner.font");
      spinner.setFont(font);
    }
  }
 protected void installDefaults() {
   Color defaultGridColor = UIManager.getColor("Table.gridColor");
   Color defaultForegroundColor = UIManager.getColor("Table.foreground");
   Color defaultBackgroundColor = UIManager.getColor("Table.background");
   Border defaultBorder = UIManager.getBorder("Table.scrollPaneBorder");
   Color defaultSelectionForeground = UIManager.getColor("Table.selectionForeground");
   Color defaultSelectionBackground = UIManager.getColor("Table.selectionBackground");
   Color defaultFocusCellForeground = UIManager.getColor("Table.focusCellForeground");
   Color defaultFocusCellBackground = new Color(153, 153, 204);
   Font defaultFont = UIManager.getFont("Table.font");
   Border defaultGridBorder = UIManager.getBorder("Table.border");
   InputMap inputMap = (InputMap) UIManager.get("Table.ancestorInputMap");
   if (!installed) {
     UIManager.getDefaults().put("Grid.gridColor", defaultGridColor);
     UIManager.getDefaults().put("Grid.foreground", defaultForegroundColor);
     UIManager.getDefaults().put("Grid.background", defaultBackgroundColor);
     UIManager.getDefaults().put("Grid.selectionForegroundColor", defaultSelectionForeground);
     UIManager.getDefaults().put("Grid.selectionBackgroundColor", defaultSelectionBackground);
     UIManager.getDefaults().put("Grid.focusForegroundColor", defaultFocusCellForeground);
     UIManager.getDefaults().put("Grid.focusBackgroundColor", defaultFocusCellBackground);
     UIManager.getDefaults().put("Grid.border", defaultGridBorder);
     UIManager.getDefaults().put("Grid.font", defaultFont);
     UIManager.getDefaults().put("Grid.scrollPaneBorder", defaultBorder);
     UIManager.getDefaults().put("Grid.ancestorInputMap", inputMap);
     installed = true;
   }
   Color foregroundColor = grid.getForeground();
   Color backgroundColor = grid.getBackground();
   Font font = grid.getFont();
   Border border = grid.getBorder();
   Color gridColor = grid.getGridColor();
   Color selectionForeground = grid.getSelectionForegroundColor();
   Color selectionBackground = grid.getSelectionBackgroundColor();
   Color focusForeground = grid.getFocusForegroundColor();
   Color focusBackground = grid.getFocusBackgroundColor();
   if (foregroundColor == null || foregroundColor instanceof UIResource)
     grid.setForeground(defaultForegroundColor);
   if (backgroundColor == null || backgroundColor instanceof UIResource)
     grid.setBackground(defaultBackgroundColor);
   if (font == null || font instanceof UIResource) grid.setFont(defaultFont);
   if (gridColor == null || gridColor instanceof UIResource) grid.setGridColor(defaultGridColor);
   if (border == null || border instanceof UIResource) grid.setBorder(defaultGridBorder);
   if (selectionForeground == null || selectionForeground instanceof UIResource)
     grid.setSelectionForegroundColor(defaultSelectionForeground);
   if (selectionBackground == null || selectionBackground instanceof UIResource)
     grid.setSelectionBackgroundColor(defaultSelectionBackground);
   if (focusForeground == null || focusForeground instanceof UIResource)
     grid.setFocusForegroundColor(defaultFocusCellForeground);
   if (focusBackground == null || focusBackground instanceof UIResource)
     grid.setFocusBackgroundColor(defaultFocusCellBackground);
 }
  /** Set the title's font. */
  protected void setupTitleFont() {
    Font font;
    if (monthYearLabel == null) return;

    // If not null, use what the user gave us

    if (titleFont != null) {
      monthYearLabel.setFont(titleFont);
    }

    // Otherwise, use the L&F default for a label

    else {
      font = UIManager.getFont("Label.font");
      monthYearLabel.setFont(font);
    }
  }
  /** Set the day-of-week labels' font. */
  protected void setupDayOfWeekFonts() {
    Font font;
    if (dayOfWeekLabels == null) return;

    // If not null, use what the user gave us

    font = dayOfWeekFont;

    // Otherwise, use 9/11 of the L&F default for a label

    if (font == null) {
      font = UIManager.getFont("Label.font");
      font = font.deriveFont((float) (font.getSize2D() * 9.0 / 11.0));
    }

    // Set the day of week labels' font

    for (int day = 0; day < 7; day++) {
      dayOfWeekLabels[day].setFont(font);
    }
  }
  /** Set the day labels' font. */
  protected void setupDayFonts() {
    Font font;
    if (dayButtons == null) return;

    // If null, use what the user gave us

    font = dayFont;

    // Otherwise, use 9/11 of the L&F default for a button

    if (font == null) {
      font = UIManager.getFont("Button.font");
      font = font.deriveFont((float) (font.getSize2D() * 9.0 / 11.0));
    }

    // Set the day labels' font

    for (int row = 0; row < 6; row++) {
      for (int day = 0; day < 7; day++) {
        dayButtons[row][day].setFont(font);
      }
    }
  }
 ParentDirectoryRenderer() {
   plainFont = UIManager.getFont("Tree.font");
   if (plainFont == null) plainFont = jEdit.getFontProperty("metal.secondary.font");
   boldFont = new Font(plainFont.getName(), Font.BOLD, plainFont.getSize());
 }