Favorite Books
import javax.swing.JDialog ; import javax.swing.JLabel ; import javax.swing.JTextField ; import javax.swing.JComboBox ; import java.awt.Font ; import java.awt.event.ActionEvent ; import java.awt.event.ActionListener ; class DiFont extends JDialog implements ActionListener { public static void main ( String [ ] args ) { new DiFont ( ) ; } Font f = new Font ( "DilleniaUPC" , Font.PLAIN , 20 ) ; //static JTextField txt1 = new JTextField ( "DilleniaUPC" ) ; static String fontName [ ] = { "Agency FB" , "Algerian" , "Andalus" , "Angsana New" , "AngsanaUPC" , "Arabic Transparent" , "Arial" , "Arial Black" , "Arial Narrow" , "Arial Rounded MT Bold" , "Arial Unicode MS" , "Baskerville Old Face" , "Batang" , "BatangChe" , "Bauhaus 93" , "Bell MT" , "Berlin Sans FB" , "Berlin Sans FB Demi" , "Bernard MT Condensed" , "Blackadder ITC" , "Bodoni MT" , "Bodoni MT Black" , "Bodoni MT Condensed" , "Bodoni MT Poster Compressed" , "Book Antiqua" , "Bookman Old Style" , "Bookshelf Symbol 7" , "Bradley Hand ITC" , "Britannic Bold" , "Broadway" , "Browallia New" , "BrowalliaUPC" , "Brush Script MT" , "Calibri" , "Californian FB" , "Calisto MT" , "Cambria" , "Cambria Math" , "Candara" , "Castellar" , "Centaur" , "Century" , "Century Gothic" , "Century Schoolbook" , "Chiller" , "Colonna MT" , "Comic Sans MS" , "Consolas" , "Constantia" , "Cooper Black" , "Copperplate Gothic Bold" , "Copperplate Gothic Light" , "Corbel" , "Cordia New" , "CordiaUPC" , "Courier" , "Courier New" , "Curlz MT" , "DilleniaUPC" , "Dotum" , "DotumChe" , "Edwardian Script ITC" , "Elephant" , "Engravers MT" , "Eras Bold ITC" , "Eras Demi ITC" , "Eras Light ITC" , "Eras Medium ITC" , "Estrangelo Edessa" , "EucrosiaUPC" , "Felix Titling" , "Fixedsys" , "Footlight MT Light" , "Forte" , "Franklin Gothic Book" , "Franklin Gothic Demi" , "Franklin Gothic Demi Cond" , "Franklin Gothic Heavy" , "Franklin Gothic Medium" , "Franklin Gothic Medium Cond" , "FreesiaUPC" , "Freestyle Script" , "French Script MT" , "Garamond" , "Gautami" , "Georgia" , "Gigi" , "Gill Sans MT" , "Gill Sans MT Condensed" , "Gill Sans MT Ext Condensed Bold" , "Gill Sans Ultra Bold" , "Gill Sans Ultra Bold Condensed" , "Gloucester MT Extra Condensed" , "Goudy Old Style", "Goudy Stout" , "Gulim" , "GulimChe" , "Gungsuh" , "GungsuhChe" , "Haettenschweiler" , "Harlow Solid Italic" , "Harrington" , "High Tower Text" , "Impact" , "Imprint MT Shadow" , "Informal Roman" , "IrisUPC" , "JasmineUPC" , "Jokerman" , "Juice ITC" , "Kartika" , "KodchiangUPC" , "Kristen ITC" , "Kunstler Script" , "Latha" , "LilyUPC" , "Lucida Bright" , "Lucida Calligraphy" , "Lucida Console" , "Lucida Fax" , "Lucida Handwriting" , "Lucida Sans" , "Lucida Sans Typewriter" , "Lucida Sans Unicode" , "Magneto" , "Maiandra GD" , "Mangal" , "Marlett" , "Matura MT Script Capitals" , "Microsoft Sans Serif" , "MingLiU" , "Mistral" , "Modern" , "Modern No. 20" , "Monotype Corsiva" , "MS Dialog" , "MS Dialog Light" , "MS Gothic" , "MS Mincho" , "MS Outlook" , "MS PGothic" , "MS PMincho" , "MS Reference Sans Serif" , "MS Reference Specialty" , "MS Sans Serif" , "MS Serif" , "MS SystemEx" , "MS UI Gothic" , "MT Extra" , "MV Boli" , "Niagara Engraved" , "Niagara Solid" , "Nina" , "NSimSun" , "OCR A Extended" , "Old English Text MT" , "Onyx" , "Palace Script MT" , "Palatino Linotype" , "Papyrus" , "Parchment" , "Perpetua" , "Perpetua Titling MT" , "Playbill" , "PMingLiU" , "Poor Richard" , "Pristina" , "Raavi" , "Rage Italic" , "Ravie" , "Rockwell" , "Rockwell Condensed" , "Rockwell Extra Bold" , "Roman" , "Script" , "Script MT Bold" , "Segoe Condensed" , "Segoe UI" , "Showcard Gothic" , "Shruti" , "SimHei" , "Simplified Arabic" , "Simplified Arabic Fixed" , "SimSun" , "Small Fonts" , "Snap ITC" , "Stencil" , "Symbol" , "System" , "Tahoma" , "Tempus Sans ITC" , "Terminal" , "Times New Roman" , "Traditional Arabic" , "Trebuchet MS" ,"Tunga" , "Tw Cen MT" , "Tw Cen MT Condensed" , "Tw Cen MT Condensed Extra Bold" , "Verdana" , "Viner Hand ITC" , "Vivaldi" , "Vladimir Script" , "Vrinda" , "Webdings" , "Wide Latin" , "Wingdings" , "Wingdings 2" , "Wingdings 3" , "WST_Czec" , "WST_Engl" , "WST_Fren" , "WST_Germ" , "WST_Ital" , "WST_Span" , "WST_Swed" ,"" } ; static String fontSize [ ] = { "2" , "5" , "8" , "10" , "12" , "14" , "18" , "20" , "22" , "25" , "28" , "32" , "36" , "40" , "44" , "48" , "52" , "57" , "63" , "67" , "73" , "85" , "93" , "97" , "100" } ; static String fontStary [ ] = { "PLAIN" , "BOLD" , "ITALIC" } ; static JComboBox cb = new JComboBox ( fontName ) ; static JComboBox txt2 = new JComboBox ( fontSize ) ; static JComboBox txt1 = new JComboBox ( fontStary ) ; static Gui gi = new Gui ( ) ; DiFont ( ) { setTitle ( " Font Format " ) ; setSize ( 300 , 110 ) ; setLayout ( null ) ; add ( new JLabel ( "Font : " ) ).setBounds ( 10 , 10 ,60 , 20 ) ; cb.setSelectedIndex ( 146 ) ; add ( cb ).setBounds ( 45 , 10 , 240 , 20 ) ; add ( new JLabel ( "FontSize : " ) ).setBounds ( 10 , 50 , 60 , 20 ) ; txt2.setSelectedIndex ( 8 ) ; add ( txt2 ).setBounds ( 70 , 50 , 50 , 20 ) ; add ( new JLabel ( "FontSty : " ) ).setBounds ( 130 , 50 , 60 , 20 ) ; add ( txt1 ).setBounds ( 185 , 50 , 100 , 20 ) ; setIaction ( ) ; } void setIaction ( ) { txt1.addActionListener ( this ) ; txt2.addActionListener ( this ) ; cb.addActionListener ( this ) ; gi.mainText.setFont ( f ) ; } public void actionPerformed ( ActionEvent e ) { int j = cb.getSelectedIndex ( ) ; int k = txt2.getSelectedIndex ( ) ; if ( fontStary [ txt1.getSelectedIndex ( ) ].equals ( "PLAIN" ) ) f = new Font ( fontName [ j ] , Font.PLAIN , Integer.parseInt ( fontSize [ k ] ) ) ; if ( fontStary [ txt1.getSelectedIndex ( ) ].equals ( "BOLD" ) ) f = new Font ( fontName [ j ] , Font.BOLD , Integer.parseInt ( fontSize [ k ] ) ) ; if ( fontStary [ txt1.getSelectedIndex ( ) ].equals ( "ITALIC" ) ) f = new Font ( fontName [ j ] , Font.ITALIC , Integer.parseInt ( fontSize [ k ] ) ) ; gi.mainText.setFont ( f ) ; } }
|
เศร้าใจจัง
ไปตายดีฟ่า ฮืออออออ