2:)
9 G! Y ^7 L4 a6 z; yFont f = new Font("隶书",Font.PLAIN,15);
2 S# @. c1 Q- P$ ^; F) `# X* n2 [UIManager.put("Button.font",font);
- j2 ^$ e/ y7 k; z) DUIManager.put("ToggleButton.font",font); 5 t0 i! y# c. } |: o0 i
UIManager.put("RadioButton.font",font);
5 S; _- G3 V. G- WUIManager.put("CheckBox.font",font); & O' o, H5 F8 p
UIManager.put("ColorChooser.font",font); 2 c. U. X# ^9 @" g* q
UIManager.put("ToggleButton.font",font);
' p7 P9 v& a/ X. Q9 X; iUIManager.put("ComboBox.font",font);
3 z* W% |; T9 }$ I/ x/ XUIManager.put("ComboBoxItem.font",font); 4 G1 e9 O% S2 {% Y1 u
UIManager.put("InternalFrame.titleFont",font);
9 y* W+ z7 d! q, Y5 `' a3 e; KUIManager.put("Label.font",font);
Z d% H# `2 f0 T) n4 YUIManager.put("List.font",font);
' U# O8 h' m) OUIManager.put("MenuBar.font",font); 7 g7 v6 E5 E# A9 V- \
UIManager.put("Menu.font",font);
6 g: D# Y. q' [- _UIManager.put("MenuItem.font",font); % y- c+ N2 W; L% g7 o7 [! k
UIManager.put("RadioButtonMenuItem.font",font); 6 Q5 H" P! N% C5 h( ]' }
UIManager.put("CheckBoxMenuItem.font",font); ! e2 ]# y* |, Q- L* h/ k- X
UIManager.put("PopupMenu.font",font); % b! y1 m7 g$ o! m* h
UIManager.put("OptionPane.font",font);
7 Q8 [2 }, o# W8 L; s% X& m1 hUIManager.put("Panel.font",font); ! x0 {* K0 r) M8 K/ g" ~
UIManager.put("ProgressBar.font",font); . c/ B3 S2 s5 Y3 f" v/ H
UIManager.put("ScrollPane.font",font); - y [. M' T! W2 f
UIManager.put("Viewport",font);
/ U- n$ I+ F8 p% j/ _. n5 X3 R" AUIManager.put("TabbedPane.font",font);
: z" C$ M7 ~, B) M& ?UIManager.put("TableHeader.font",font); ) N% x) `0 n. u }) [$ }# t* H' a3 y! a
UIManager.put("TextField.font",font); , a, ~& w6 d( U' `" p6 c/ j# |0 ?
UIManager.put("PasswordFiled.font",font); / h v6 ?( B( j* i; {
UIManager.put("TextArea.font",font);
) \" ^+ U- \1 }$ oUIManager.put("TextPane.font",font); 4 I( ?/ l. @% i( s" o
UIManager.put("EditorPane.font",font);
' A7 Y, g5 c3 fUIManager.put("TitledBorder.font",font); 9 L j+ N1 V2 }5 d1 J, \
UIManager.put("ToolBar.font",font); " g" ?( L; h0 E7 i3 m0 S
UIManager.put("ToolTip.font",font); % ?2 c- K& `# Z2 Z D0 r6 {1 Y( S
UIManager.put("Tree.font",font); ) k& X9 H5 {: `) a: n# U# G
! j% s5 J& @1 { D7 i; z
3:)针对jsp和servlet:
; \; V* ^; R& P解决办法:
! x( d. ~$ c6 p, S/ u6 R第一: - `3 c: c6 B& C+ L2 {8 Y
在jsp页面加入: 3 l0 _9 b+ }5 Z& h) [! l+ s- `
F! s' C9 V4 b, ^7 |
或者在servlet里面 2 w% b- _9 b: t8 p- |- M& c
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { + L% m* X: I: ? f+ m
response.setContentType("text/html; charset=gb2312");//这是重要的 ' M% c8 L% ^3 R" k
上面的如果在不行就用如下的方法在数据入库前进行调用: # `! j1 Z4 G) e& Q3 x
public static String UnicodeToChinese(String s){ 3 Q7 @' R9 T3 t+ C
try{
& d& E( }# e, W& q3 c1 `% jif(s==null||s.equals("")) return ""; 3 Y+ @& \! g2 Y% D: E3 v
String newstring=null; 3 u3 Q! ? G+ I" m+ \+ w
newstring=new String(s.getBytes("ISO8859_1"),"gb2312");
3 \" K" a' O6 w1 q! t, t4 R. a6 m, H% Ureturn newstring;
. F( M8 L% J/ S7 y1 y}
6 h* c, A$ {0 L& T0 ^catch(UnsupportedEncodingException e) 7 v3 O# R" B$ u$ u
{ 1 T) M$ H9 d$ T8 k
return s; # e' Y+ Q) Y; T' v4 ]8 X$ _
} % L; E# S- P; ]3 e
}
+ {5 A8 ~6 ?( w9 v# u: y! Z. U1 A2 Q2 x- t" B2 u+ ~# D& k! E
public static String ChineseToUnicode(String s){
. i/ R( n: r, o( F+ a5 Qtry{
. K7 _8 I) d' A6 B8 mif(s==null||s.equals("")) return ""; ( \: {7 }6 @' c9 o
String newstring=null;
5 u1 n5 S# `! Z' Enewstring=new String(s.getBytes("gb2312"),"ISO8859_1");
- {5 H( ?1 e( w$ Ereturn newstring; - P) s3 P" L: g5 ^3 t' O
}
. m/ } w8 U' [9 C. I: X+ lcatch(UnsupportedEncodingException e)
# y# o1 p8 O# Y: M# |8 y{
. Z- k# r4 J4 ~, O& [. wreturn s; ! {, d* D: a% m; _& k! m4 s3 B. L
} E4 ^/ Q6 i( c0 P
} |