FancyStyledDocument.java :  » Game » aetheria » eu » irreality » age » swing » Java Open Source

Java Open Source » Game » aetheria 
aetheria » eu » irreality » age » swing » FancyStyledDocument.java
/*
 * created on denebola3, 2010-11-09
 */

package eu.irreality.age.swing;

import java.awt.Font;

import javax.swing.text.AttributeSet;
import javax.swing.text.DefaultStyledDocument;

/**
 * StyledDocument with the capability of handling FancyAttributeSets
 * with loaded true type fonts.
 * @author carlos
 *
 */
public class FancyStyledDocument extends DefaultStyledDocument 
{
  
  public Font getFont(AttributeSet attr)
  {
    if ( attr instanceof FancyAttributeSet )
    {
      if ( ((FancyAttributeSet)attr).getFont() != null )
        return ((FancyAttributeSet)attr).getFont();
    }
    return super.getFont(attr);
  }
  
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.