1 43 44 package org.jfree.ui; 45 46 import java.awt.BorderLayout ; 47 import java.awt.Dialog ; 48 import java.awt.Font ; 49 import java.awt.Frame ; 50 51 import javax.swing.BorderFactory ; 52 import javax.swing.JPanel ; 53 54 59 public class FontChooserDialog extends StandardDialog { 60 61 62 private FontChooserPanel fontChooserPanel; 63 64 72 public FontChooserDialog(final Dialog owner, final String title, final boolean modal, final Font font) { 73 super(owner, title, modal); 74 setContentPane(createContent(font)); 75 } 76 77 85 public FontChooserDialog(final Frame owner, final String title, final boolean modal, final Font font) { 86 super(owner, title, modal); 87 setContentPane(createContent(font)); 88 } 89 90 95 public Font getSelectedFont() { 96 return this.fontChooserPanel.getSelectedFont(); 97 } 98 99 106 private JPanel createContent(Font font) { 107 final JPanel content = new JPanel (new BorderLayout ()); 108 content.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); 109 if (font == null) { 110 font = new Font ("Dialog", 10, Font.PLAIN); 111 } 112 this.fontChooserPanel = new FontChooserPanel(font); 113 content.add(this.fontChooserPanel); 114 115 final JPanel buttons = createButtonPanel(); 116 buttons.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0)); 117 content.add(buttons, BorderLayout.SOUTH); 118 119 return content; 120 } 121 122 } 123 | Popular Tags |