001 /** 002 * iFish - An iRiver iHP jukebox database creation tool 003 * 004 * Copyright (C) 2009 Richard "Shred" Körber 005 * http://ifish.shredzone.org 006 * 007 * This program is free software: you can redistribute it and/or modify 008 * it under the terms of the GNU General Public License as published by 009 * the Free Software Foundation, either version 3 of the License, or 010 * (at your option) any later version. 011 * 012 * This program is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 015 * GNU General Public License for more details. 016 * 017 * You should have received a copy of the GNU General Public License 018 * along with this program. If not, see <http://www.gnu.org/licenses/>. 019 */ 020 package net.shredzone.ifish.gui; 021 022 import java.awt.Component; 023 import java.awt.Font; 024 025 import javax.swing.border.TitledBorder; 026 027 /** 028 * Purpose of this class is to have all TitledBorder tied together in one 029 * single class so it can easily be configured. 030 * 031 * @author Richard Körber <dev@shredzone.de> 032 * @version $Id: MyTitledBorder.java 291 2009-04-28 21:29:27Z shred $ 033 */ 034 public class MyTitledBorder extends TitledBorder { 035 private static final long serialVersionUID = 3256441400022152754L; 036 037 /** 038 * My own TitledBorder. 039 * 040 * @param title Titel 041 */ 042 public MyTitledBorder( String title ) { 043 super( 044 null, 045 title, 046 TitledBorder.RIGHT, 047 TitledBorder.DEFAULT_POSITION 048 ); 049 } 050 051 /** 052 * Override getFont() to correct the font size. 053 * 054 * @param c Component to be painted 055 * @return Font for this component 056 */ 057 @Override 058 protected Font getFont( Component c ) { 059 return c.getFont().deriveFont( Font.BOLD, c.getFont().getSize2D()*0.8f ); 060 } 061 062 }