/*
* Created on 14/10/2004
*
* Swing Components - visit http://sf.net/projects/gfd
*
* Copyright (C) 2004 Igor Regis da Silva Simes
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
package br.com.gfpshare.plaf;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.metal.MetalLabelUI;
/**
*
* Classe que representa a UI do coponente JLabel.
* O mtodo paint foi sobrescrito para acrescentar a capacidade de pintar
* fontes com suavizao de borda, melhorando sua aparencia no Linux e no OS/2.
*
* @author Igor Regis da Silva Simes
*/
public class IgorLabelUI extends MetalLabelUI {
/**
* Usamos aqui uma varivel esttica que ser responsvel pelo look and feel de
* todos os JLabels da aplicao.
*/
private static final IgorLabelUI me = new IgorLabelUI();
/** O mtodo paint foi sobrescrito para acrescentar a capacidade de pintar
* fontes com suavizao de borda, melhorando sua aparencia no Linux e no OS/2.
* @param g Contexto grfico
* @param c Componente a ser pintado
*/
@Override
public void paint(Graphics g, JComponent c)
{
if (g != null)
{
Graphics2D g2d = (Graphics2D)g;
g2d.addRenderingHints(new RenderingHints(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON));
}
super.paint(g, c);
}
/** Mtodo que retorna uma instncia deste componente que ser responsvel pelo
* look and feel do componete JLabel.
* @param c Componete o qual seseja-se criar um componente UI
* @return Componente responsvel pela UI
*/
public static ComponentUI createUI(JComponent c)
{
return me;
}
}
|