1 import java.awt.*; 2 import java.awt.event.*; 3 import java.awt.image.ImageObserver ; 4 import java.io.Serializable ; 5 import java.util.*; 6 import javax.swing.*; 7 import javax.accessibility.Accessible ; 8 import org.jivesoftware.smack.SmackConfiguration; 9 import whisper.Util; 10 import java.util.Properties ; 11 12 13 public final class JAboutDialog extends JDialog implements Accessible , ImageObserver , MenuContainer, RootPaneContainer, Serializable , SwingConstants,WindowConstants{ 14 15 final JTabbedPane tabs=new JTabbedPane(); 16 17 final Properties sys=System.getProperties(); 18 19 final JPanel versionPanel=new JPanel(); 20 final JLabel versionLbl=new JLabel("<html><p align='center'><b>"+Lang.gs("version")+" "+WhisperIM.VERSION+"</b><br><br>"+WhisperIM.VERSION_INFO+"</p></html>"); 21 22 static final ImageIcon LOGO=new ImageIcon("img/logo_big.gif"); 23 24 final JTextArea credits=new JTextArea("OS: "+sys.getProperty("os.name")+" "+sys.getProperty("os.version")+"\r\nJava VM: "+sys.getProperty("java.vm.vendor")+" "+sys.getProperty("java.vm.version")+"\r\nWhisper Lib: "+Util.getVersion()+"\r\nSmack Lib: "+SmackConfiguration.getVersion()+"\r\n\r\nCredits & Thanks:\r\n\r\nThe Smack development team. \r\n\r\nBruce Schneier www.schneier.com and Niels Ferguson www.macfergus.com/niels/, designers of Twofish.\r\n\r\nPhil Zimmerman, creator of PGP.\r\n\r\nKunststoff Look & Feel by Incors www.incors.org/archive\r\n\r\nDean S. Jones for icons www.gallant.com/icons.htm .\r\n\r\nThis product includes software developed by Jive Software http://www.jivesoftware.com\r\n",6,23); 25 26 final JScrollPane creditsSP=new JScrollPane(credits); 27 final JPanel btnPanel=new JPanel(new FlowLayout(FlowLayout.CENTER,10,10)); 28 final JButton okBtn=new JButton(Lang.gs("ok")); 29 30 final BtnClick click=new BtnClick(); 31 32 public JAboutDialog(){ 33 super(WhisperIM.MainWindow,"Whisper Instant Messenger",true); 34 setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 35 Container cp=getContentPane(); 36 cp.setLayout(new BorderLayout(10,10)); 37 38 versionPanel.add(versionLbl); 39 40 okBtn.addActionListener(click); 41 okBtn.setDefaultCapable(true); 42 btnPanel.add(okBtn); 43 getRootPane().setDefaultButton(okBtn); 44 45 credits.setLineWrap(true); 46 credits.setWrapStyleWord(true); 47 credits.setEditable(false); 48 49 creditsSP.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 50 creditsSP.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); 51 52 cp.add(versionPanel,BorderLayout.NORTH); 53 cp.add(creditsSP,BorderLayout.CENTER); 54 cp.add(btnPanel,BorderLayout.SOUTH); 55 cp.add(new JLabel(LOGO),BorderLayout.WEST); 56 cp.add(new JPanel(),BorderLayout.EAST); 57 setLocationRelativeTo(WhisperIM.MainWindow); 58 pack(); 59 addKeyListener(new KeyAction()); 60 addMouseListener(new MouseAction()); 61 } 62 63 public void show(Component owner){ 64 setLocationRelativeTo(owner); 65 getRootPane().setDefaultButton(okBtn); 66 super.show(); 67 okBtn.requestFocusInWindow(); 68 } 69 70 final class BtnClick implements ActionListener{ 71 public void actionPerformed(ActionEvent ae){ 72 dispose(); 73 } 74 } 75 76 } | Popular Tags |