001    // GraphLab Project: http://graphlab.sharif.edu
002    // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology
003    // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/
004    package graphlab.ui.components.gpropertyeditor.renderers;
005    
006    import graphlab.ui.components.gpropertyeditor.GBasicCellRenderer;
007    
008    import javax.swing.*;
009    import java.awt.*;
010    
011    /**
012     * @author azin azadi
013     */
014    public class GFontRenderer implements GBasicCellRenderer<Font> {
015        public Component getRendererComponent(Font value) {
016            JLabel l = new JLabel(value.getFontName()) {
017                /**
018                 *
019                 */
020                private static final long serialVersionUID = -1315161861822432705L;
021    
022                public void paint(Graphics g) {
023                    ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
024                    super.paint(g);
025                }
026            };
027            l.setFont(value);
028            l.repaint();
029            return l;
030        }
031    }