1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
| package main;
|
| import java.awt.Font;
| import java.util.HashMap;
| import java.util.Map;
|
|
| public class FontUtils {
|
| public static Map<MyFont,Font> myFonts = new HashMap<>();
|
| public enum MyFont{
| DeFault, //ĬÈÏ×ÖÌå
| HomeBtn, //Ê×Ò³°´Å¥×ÖÌå
|
| BorderFont, //±ß¿ò×ÖÌå
|
| }
|
| static {
| /**
| * ĬÈÏ×ÖÌå
| */
| myFonts.put(MyFont.DeFault, new Font("ËÎÌå", Font.PLAIN, 16));
|
| /**
| * Ê×Ò³°´Å¥×ÖÌå
| */
| myFonts.put(MyFont.HomeBtn, new Font("ËÎÌå", Font.PLAIN, 32));
|
| /**
| * ±ß¿ò×ÖÌå
| */
| myFonts.put(MyFont.BorderFont, new Font("ËÎÌå", Font.PLAIN, 18));
|
| }
|
|
|
| public static Font getMyFont(MyFont fontName) {
| Font font = myFonts.get(fontName);
| if(null == font) {
| myFonts.get(MyFont.DeFault);
| }
| return font;
| }
| }
|
|