2
package org.crosswire.common.config.swing;
4
import javax.swing.BorderFactory;
5
import javax.swing.JComponent;
6
import javax.swing.border.Border;
8
import org.crosswire.common.config.Choice;
9
import org.crosswire.common.swing.FontChooser;
10
import org.crosswire.common.swing.GuiConvert;
13
* A swing view of a FontChoice.
15
* <p><table border='1' cellPadding='3' cellSpacing='0'>
16
* <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
18
* Distribution Licence:<br />
19
* JSword is free software; you can redistribute it
20
* and/or modify it under the terms of the GNU General Public License,
21
* version 2 as published by the Free Software Foundation.<br />
22
* This program is distributed in the hope that it will be useful,
23
* but WITHOUT ANY WARRANTY; without even the implied warranty of
24
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25
* General Public License for more details.<br />
26
* The License is available on the internet
27
* <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, or by writing to:
28
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
29
* MA 02111-1307, USA<br />
30
* The copyright to this program is held by it's authors.
31
* </font></td></tr></table>
33
* @author Joe Walker [joe at eireneh dot com]
36
public class FontField extends FontChooser implements Field
43
Border title = BorderFactory.createTitledBorder("Select Font");
44
Border pad = BorderFactory.createEmptyBorder(5, 5, 5, 5);
45
setBorder(BorderFactory.createCompoundBorder(title, pad));
49
* Some fields will need some extra info to display properly
50
* like the options in an options field. FieldMap calls this
51
* method with options provided by the choice.
52
* @param param The options provided by the Choice
54
public void setChoice(Choice param)
59
* Return a string version of the current value
60
* @return The current value
62
public String getValue()
64
return GuiConvert.font2String(getStyle());
68
* Set the current value
69
* @param value The new text
71
public void setValue(String value)
73
setStyle(GuiConvert.string2Font(value));
77
* Get the actual component that we can add to a Panel.
78
* (This can well be this in an implementation).
80
public JComponent getComponent()