2:)
; l4 A: V8 e& ~Font f = new Font("隶书",Font.PLAIN,15); $ ~2 l) H# H& j+ Y! O" k# m0 l
UIManager.put("Button.font",font); 8 F" B) i6 ~/ }$ U" Q3 M; D$ i
UIManager.put("ToggleButton.font",font);
/ B- f3 V1 a( K/ L ~8 V) ]/ VUIManager.put("RadioButton.font",font); & _) E" E& \2 d {5 }0 y
UIManager.put("CheckBox.font",font);
! d7 h! {) {6 K. u2 g4 X( WUIManager.put("ColorChooser.font",font); - z- ~ u; p! i$ a$ @9 k
UIManager.put("ToggleButton.font",font); ( b9 x, y( r) k3 R T' o+ \3 M
UIManager.put("ComboBox.font",font);
3 I( w2 o9 h- c% Q/ C6 dUIManager.put("ComboBoxItem.font",font);
- h v9 d# V2 Y! L8 i7 ?9 VUIManager.put("InternalFrame.titleFont",font);
5 P [7 H/ s. y" u* ]- z& A, t3 fUIManager.put("Label.font",font); 8 U: L( g( D# V7 E0 C
UIManager.put("List.font",font);
' `$ [, I6 h+ ]/ C! u- jUIManager.put("MenuBar.font",font);
* g7 `4 L6 m: d( H: H; x5 HUIManager.put("Menu.font",font); ( z) o5 S) `- @4 t
UIManager.put("MenuItem.font",font);
% e: ^7 a7 A! \" b8 Y# G9 S4 ~UIManager.put("RadioButtonMenuItem.font",font);
. A- N+ m2 g. p |6 f. wUIManager.put("CheckBoxMenuItem.font",font); 7 k4 _" h, m' |4 j- y1 w# X$ L) t& v( Y
UIManager.put("PopupMenu.font",font); / o( Z; B4 j! Z7 n9 t" D' q: c! T, \, B
UIManager.put("OptionPane.font",font);
9 s. c0 I( K4 p* J* P0 AUIManager.put("Panel.font",font);
0 A$ L* g1 Z, |6 OUIManager.put("ProgressBar.font",font); % E8 H/ \; u8 b8 G, u
UIManager.put("ScrollPane.font",font);
; |9 o2 c& J# V* uUIManager.put("Viewport",font);
% Y/ _# B# c' v8 P- EUIManager.put("TabbedPane.font",font);
7 l+ a6 R D' P5 V1 G* `6 s3 ]' tUIManager.put("TableHeader.font",font); 0 Q. T9 Z8 q' g$ D
UIManager.put("TextField.font",font);
B! s. T; M; C* {; ~8 R* NUIManager.put("PasswordFiled.font",font); ! X) g4 J" @$ W4 E6 o
UIManager.put("TextArea.font",font); : u5 _0 l. l( x! K3 P
UIManager.put("TextPane.font",font); 1 J! U1 I" x9 R/ {* u# Z
UIManager.put("EditorPane.font",font);
' Y5 s5 D; }) g- `( t3 ?UIManager.put("TitledBorder.font",font); 4 a% k' |4 P1 l8 {) a2 n3 S/ M
UIManager.put("ToolBar.font",font); ( b1 E* q) h! Q c0 R% c# }
UIManager.put("ToolTip.font",font);
- o, P: L$ w0 e; O* w V' }UIManager.put("Tree.font",font); 5 a4 d- X* J7 c' U. W9 r
8 D0 @7 j; t& ~$ |! [; }6 C G" ?
3:)针对jsp和servlet: 7 ~( W1 ~& O1 j$ ~
解决办法:
. N9 ?) f) K* h第一: , v' r+ K* [( z8 L7 N
在jsp页面加入:
+ u; v6 x& d8 `0 t, o9 W $ Y. H- \0 F' s3 Q# t, r B
或者在servlet里面
- @2 h7 F0 ?! }# P5 B: Zpublic void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { 1 f4 q q4 `* T# g0 V
response.setContentType("text/html; charset=gb2312");//这是重要的
N! O+ N3 B( c1 v4 {上面的如果在不行就用如下的方法在数据入库前进行调用:
3 Z2 g7 @# m: h2 }9 y! R/ d: ypublic static String UnicodeToChinese(String s){
6 ` u- R/ v' P- I" {: k% ctry{
' b% M) B! j1 R0 B3 o! L* Lif(s==null||s.equals("")) return "";
% p/ B" l3 e2 Y VString newstring=null; 3 n1 r g; J, z, @# T! x/ n( J
newstring=new String(s.getBytes("ISO8859_1"),"gb2312");
: L& J, z" _9 [" treturn newstring; 9 D4 f# t8 d9 P: H
}
0 m8 J( c8 X F. _7 f5 O2 ~catch(UnsupportedEncodingException e) . q! X- w/ T$ e: M% O6 x
{ 0 Q+ j# g* J- v- A# O: G" _; {, c
return s; , C. T! a& A; t; d0 \
}
' g/ e1 P8 m( F: G8 O} 8 U, N: I6 Q# C* N
0 |4 ~8 G- d) |) P. B; V, upublic static String ChineseToUnicode(String s){
1 F3 z3 A4 h; d, {3 u; I7 N2 ptry{
1 @; Q+ \ D/ x" Q8 {3 ]if(s==null||s.equals("")) return ""; g3 }, m4 z& h! c5 E! m( B* U
String newstring=null; ; ?* O0 [" Z% x' Q a/ T
newstring=new String(s.getBytes("gb2312"),"ISO8859_1"); ( u# C8 h2 \$ B5 ^( }4 V
return newstring; 6 A$ e* I! R- J. @
} - S4 K) Z9 J+ k
catch(UnsupportedEncodingException e) 1 B4 I* Z! Z' ?+ c. x
{
) _6 j8 e6 Y8 S4 f+ T% S5 Hreturn s; & C( x5 U' f- D T2 e
} ( r" [' K( | L) R# J4 P1 H
} |