1 44 45 package org.jfree.ui; 46 47 import java.awt.Font ; 48 import java.util.ResourceBundle ; 49 50 import javax.swing.JTextField ; 51 52 58 public class FontDisplayField extends JTextField { 59 60 61 private Font displayFont; 62 63 64 protected static final ResourceBundle localizationResources = 65 ResourceBundle.getBundle("org.jfree.ui.LocalizationBundle"); 66 67 72 public FontDisplayField(final Font font) { 73 super(""); 74 setDisplayFont(font); 75 setEnabled(false); 76 } 77 78 83 public Font getDisplayFont() { 84 return this.displayFont; 85 } 86 87 92 public void setDisplayFont(final Font font) { 93 this.displayFont = font; 94 setText(fontToString(this.displayFont)); 95 } 96 97 104 private String fontToString(final Font font) { 105 if (font != null) { 106 return font.getFontName() + ", " + font.getSize(); 107 } 108 else { 109 return localizationResources.getString("No_Font_Selected"); 110 } 111 } 112 113 } 114 | Popular Tags |