Revision 44455 trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.ui/src/main/java/org/gvsig/gui/beans/swing/JComboBoxFonts.java
JComboBoxFonts.java | ||
---|---|---|
30 | 30 |
/** |
31 | 31 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
32 | 32 |
*/ |
33 |
public class JComboBoxFonts extends JComboBox{ |
|
34 |
private static final long serialVersionUID = -1096327332248927959L; |
|
33 |
public class JComboBoxFonts extends JComboBox { |
|
35 | 34 |
|
36 |
public JComboBoxFonts() { |
|
37 |
super(); |
|
38 |
initialize(); |
|
39 |
} |
|
35 |
private static final long serialVersionUID = -1096327332248927959L; |
|
40 | 36 |
|
41 |
private void initialize() { |
|
42 |
// Font info is obtained from the current graphics environment. |
|
43 |
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); |
|
37 |
public JComboBoxFonts() { |
|
38 |
super(); |
|
39 |
initialize(); |
|
40 |
} |
|
44 | 41 |
|
45 |
// --- Get an array of font names (smaller than the number of fonts) |
|
46 |
String[] fontNames = ge.getAvailableFontFamilyNames(); |
|
47 |
for (int i = 0; i < fontNames.length; i++) { |
|
48 |
addItem(fontNames[i]); |
|
49 |
}; |
|
50 |
} |
|
42 |
private void initialize() { |
|
43 |
// Font info is obtained from the current graphics environment. |
|
44 |
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); |
|
51 | 45 |
|
46 |
// --- Get an array of font names (smaller than the number of fonts) |
|
47 |
String[] fontNames = ge.getAvailableFontFamilyNames(); |
|
48 |
for (int i = 0; i < fontNames.length; i++) { |
|
49 |
addItem(fontNames[i]); |
|
50 |
}; |
|
51 |
try { |
|
52 |
this.setSelectedItem("Arial"); |
|
53 |
this.setSelectedItem("DejaVu Sans"); |
|
54 |
this.setSelectedItem("Liberation Sans"); |
|
55 |
this.setSelectedItem("Serif"); |
|
56 |
|
|
57 |
} catch (Exception ex) { |
|
58 |
|
|
59 |
} |
|
60 |
} |
|
61 |
|
|
52 | 62 |
} |
Also available in: Unified diff