For Applet and AWT: 1 :) font f = new font (uiResource.getstring ("default_font"), font.plain, 12); uimanager.put ("label.font", f); uimanager.put ("Label. Foreground ", color.black); UIManager.put (" Button.Font ", F); UIManager.Put (" Menu.Font ", F); UIManager.put (" MenuItem.font ", F); UIManager.put ("List.Font", F); UIManager.Put ("Checkbox.Font", F); UIManager.Put ("Radiobutton.Font", F); UIManager.Put ("ComboBox.Font", F); UIManager .put ("textarea.font", f); 2 :) font f = new font ("书", font.plain, 15); UIManager.put ("Button.Font", font); uimanager.put (" ToggleButton.font ", font); UIManager.put (" Radiobutton.Font ", Font); UIManager.put (" Checkbox.Font ", font); UIManager.put (" Colorchooser.Font ", font); uimanager.put ("ToggleButton.Font", Font); UIManager.Put ("ComboBox.Font", Font); UIManager.put ("ComboBoxItem.Font", Font); UIManager.put ("INTERNALFRAME.TILEFONT", FONT); UIManager .put ("label.font", font; uimanager.put ("list.font", font); uimanager.put ("menubar.font", font); UIManager.put ("menu.font", font) UIManager.put ("MenuItem.Font ", font); UIManager.Put (" RadiobuttonMenuItem.font ", font); UIManager.put (" CheckBoxMenuItem.font ", font); uimanager.put (" PopupMenu.font ", font); UIManager.put (" Optionpane .font ", font); UIManager.put (" Panel.Font ", Font); UIManager.put (" ProgressBar.Font ", Font); UIManager.put (" scrollpane.font ", font); UIManager.put "Viewport", font); UIManager.put ("Tabbedpane.Font", Font); UIManager.put ("TableHeader.Font", font); uimanager.put ("
TEXTFIELD.FONT ", FONT); UIManager.put (" PasswordFiled.Font ", font; uimanager.put (" textarea.font ", font); UIManager.put (" textpane.font ", font); uimanager.put ("Editorpane.font", font; uimanager.put ("Titledborder.font", font); UIManager.put ("Toolbar.Font", Font); UIManager.put ("Tooltip.Font", Font); UIManager .put ("tree.font", font); For JSP and Servlet: Add: <% @ page contentty = "text / html; charset = gb2312"%> or in servlet (httpservletRequest Request, HttpservletResponse response, ioExcetion {response.setContentType ("text / html; charset = GB2312"); // This is an important above if you don't do it, use the following method to call before the data is stored: Public Static String UnicoDetoChinese (String s) {try {if (s == null || s.equals (")) Return" "; string newstring = null; newstring = new string (S.GetBytes (" ISO8859_1 ")," GB2312 " ); return newstring;} catch (unsupporteencodingexception e) {return s;}} public static string chinesetounicode (string s) {try {if (s == null || s.equals (")) Return"; string newstring = NULL; newstring = new string (s.get BYTES ("GB2312"), "ISO8859_1"); return.com;} catch (unsupporteencodingexcection e) {returnide s;}}
Solve WebLogic / WebShpere Chinese issues: The Chinese environment is required in the web.xml file. R As:
JavaMail Accessories Chinese garblered: / * @ @ 从 b b i 编 i i 文件 文件 号 @ Because the bodypart.getFileName () process has made a file name once, sometimes you can use * / public static string getisofilename ( Part body {// Set a flag, determine that the file name is obtained from Content-Disposition or get Boolean Flag = true; if (body == null) {Return Null;} String [] cdis; try} CDIS = body.getHeader ("Content-Disposition");} catch (Exception E) {return null;} if (cdis == null) {flag = false;} if (! flag) {Try {CDIS = body.getHeader ("Content-Type");} Catch (Exception E) {Return NULL;}}}}} (cdis == null) {Return NULL;}}}} {Return NULL;} // Content-Disposition Gets the file name if (flag) {INT POS = CDIS [0] .indexof ("filename ="); if (pOS <0) {return null;} // If file name belt quotes IF (CDIS [ 0] .CHARAT (CDIS [0] .length () - 1) == '") {return cdis [0] .substring (POS 10, CDIS [0] .length () - 1);} Return CDIS [0]. Substring (POS 9, CDIS [0] .length ());} else {int pos = CDIS [0] .indexof ("name ="); if (POS <0) {Return Null;} // If the file name is quoted IF (CDIS [0] .CHARAT (CDIS [0] .length () - 1) == '"') {Return CDIS [0] .substring (POS 6, CDIS [0] } return cdis [0 ] .substring (POS 5, CDIS [0] .length ());}}
String section: public int getcount (string str, string sign) {// finds the STR in a string, the number of occurrences IF (Str == null) return 0; StringTokenizer s = New StringTokenizer (Str, SIGN); Return S.CountToKens (); PUBLIC STRING [] GetArray (String Str, String Sign) {// Press a specific substring S as a marker, and sub-string is intercepting the array. INT count = getCount (STR, SIGN); INT J = 0; string [] arr = new string [count]; for (int i = 0; i