home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 February / PCpro_2005_02.ISO / files / opensource / Opcion_1.1.1 / Opcion_v1.1.1.exe / FontViewer / components / AAToggleButton.class (.txt) < prev    next >
Encoding:
Java Class File  |  2004-04-25  |  1.5 KB  |  37 lines

  1. package FontViewer.components;
  2.  
  3. import java.awt.Graphics;
  4. import java.awt.Graphics2D;
  5. import java.awt.RenderingHints;
  6. import javax.swing.JToggleButton;
  7.  
  8. public class AAToggleButton extends JToggleButton {
  9.    String fname;
  10.    String floc;
  11.  
  12.    public AAToggleButton(String s, String fname, String floc) {
  13.       super(s);
  14.       this.fname = fname;
  15.       this.floc = floc;
  16.       this.setToolTipText(fname + " (" + floc + ")");
  17.    }
  18.  
  19.    public String getFName() {
  20.       return this.fname;
  21.    }
  22.  
  23.    public String getFLoc() {
  24.       return this.floc;
  25.    }
  26.  
  27.    public void paintComponent(Graphics g) {
  28.       Graphics2D g2d = null;
  29.       if (g instanceof Graphics2D) {
  30.          g2d = (Graphics2D)g;
  31.          g2d.addRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
  32.       }
  33.  
  34.       super.paintComponent(g);
  35.    }
  36. }
  37.