1 7 8 import java.awt.*; 9 import java.util.*; 10 import javax.swing.*; 11 import javax.swing.border.*; 12 13 14 17 public class InfoPanel extends JPanel { 18 19 JLabel jLabel1 = new JLabel(); 20 JLabel jLabel2 = new JLabel(); 21 JLabel jLabel3 = new JLabel(); 22 JLabel jLabel4 = new JLabel(); 23 JLabel jLabel5 = new JLabel(); 24 JLabel jLabel6 = new JLabel(); 25 JLabel jLabel8 = new JLabel(); 26 JLabel jLabel9 = new JLabel(); 27 JLabel jLabel7 = new JLabel(); 28 JLabel jLabel10 = new JLabel(); 29 Border bord = new EtchedBorder(); 30 GridBagLayout gridBagLay = new GridBagLayout(); 31 32 JLabel jL; 33 34 37 public InfoPanel() { 38 try { 39 jbAbout(); 40 } 41 catch (Exception e) { 42 e.printStackTrace(); 43 } 44 } 45 52 public InfoPanel(ResourceBundle rb,String lang,String pf,String defHyph) { 53 try { 54 jbParam(rb,lang,pf,defHyph); 55 } 56 catch (Exception e) { 57 e.printStackTrace(); 58 } 59 } 60 63 private void jbAbout() throws Exception { 64 jLabel4.setText("chupo@iis.ns.ac.yu"); 65 jLabel4.setFont(new Font("Dialog", 1, 12)); 66 jLabel1.setText("Authors:"); 67 jLabel1.setHorizontalAlignment(SwingConstants.RIGHT); 68 jLabel2.setText("Stefanovic Nenad"); 69 jLabel2.setFont(new Font("Dialog", 1, 12)); 70 jLabel7.setText("Bojanic Sasa"); 71 jLabel7.setFont(new Font("Dialog", 1, 12)); 72 jLabel10.setText("Puskas Vladimir"); 73 jLabel10.setFont(new Font("Dialog", 1, 12)); 74 jLabel9.setText("FOP applet"); 75 jLabel9.setFont(new Font("Dialog", 3, 14)); 76 jLabel3.setText("e-mail:"); 77 jLabel3.setHorizontalAlignment(SwingConstants.RIGHT); 78 jLabel5.setText("version:"); 79 jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); 80 jLabel6.setText("1.0"); 81 jLabel6.setFont(new Font("Dialog", 1, 12)); 82 this.setLayout(gridBagLay); 83 this.add(jLabel9, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, 84 GridBagConstraints.CENTER, GridBagConstraints.VERTICAL, new Insets(2, 0, 5, 0), 0, 0)); 85 this.add(jLabel1, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 86 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 8, 0, 5), 0, 0)); 87 this.add(jLabel2, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, 88 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); 89 this.add(jLabel7, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, 90 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); 91 this.add(jLabel10, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, 92 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); 93 this.add(jLabel3, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, 94 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 8, 0, 5), 0, 0)); 95 this.add(jLabel4, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, 96 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); 97 this.add(jLabel5, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, 98 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 8, 0, 5), 0, 0)); 99 this.add(jLabel6, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, 100 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0)); 101 this.setBorder(bord); 102 } 103 112 private void jbParam(ResourceBundle rb,String lang,String pf,String defHyph) throws Exception { 113 this.add(new JLabel(" 'Main' property file = "+pf+".properties ")); 114 this.add(new JLabel(" 'Language' property file = Text_"+lang+".properties ")); 115 this.add(new JLabel(" Height of lines = "+getResourceString("lineHeight",rb))); 116 this.add(new JLabel(" Hyphenation language = "+defHyph)); 117 String [] defKeys = TextEditor.tokenize(getResourceString("defvalues",rb)); 118 this.setLayout(new GridLayout(defKeys.length+4,1)); 119 for (int i=0; i<defKeys.length; i++) 120 this.add(new JLabel(" "+defKeys[i]+" = "+getResourceString(defKeys[i],rb))); 121 this.setBorder(bord); 122 } 123 135 protected String getResourceString(String nm,ResourceBundle rb) { 136 String str; 137 try { 138 str = rb.getString(nm); 139 } 140 catch (MissingResourceException mre) { 141 str = null; 142 } 143 if (str != null) str=str.trim(); 144 return str; 145 } 146 } 147 | Popular Tags |