1 7 8 package org.gjt.jclasslib.browser; 9 10 import org.gjt.jclasslib.util.GUIHelper; 11 12 import javax.swing.*; 13 import java.awt.*; 14 import java.awt.event.ActionEvent ; 15 import java.awt.event.ActionListener ; 16 17 23 public class BrowserAboutDialog extends JDialog { 24 25 private JButton btnOk; 26 27 32 public BrowserAboutDialog(JFrame parent) { 33 super(parent); 34 setupControls(); 35 setupComponent(); 36 } 37 38 private void setupComponent() { 39 40 setModal(true); 41 setTitle("About the jclasslib bytecode viewer"); 42 setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); 43 setSize(400, 250); 44 GUIHelper.centerOnParentWindow(this, getOwner()); 45 46 JComponent contentPane = (JComponent)getContentPane(); 47 contentPane.setLayout(new GridBagLayout()); 48 GridBagConstraints gc = new GridBagConstraints(); 49 gc.insets = new Insets(10, 5, 0, 5); 50 gc.gridx = 0; 51 gc.gridy = GridBagConstraints.RELATIVE; 52 53 gc.anchor = GridBagConstraints.CENTER; 54 gc.weightx = 1; 55 56 JLabel label = new JLabel("jclasslib bytecode viewer"); 57 label.setFont(label.getFont().deriveFont(Font.BOLD)); 58 contentPane.add(label, gc); 59 gc.insets.top = 5; 60 contentPane.add(new JLabel("Version " + BrowserApplication.APPLICATION_VERSION), gc); 61 contentPane.add(new JLabel("Copyright ej-technologies GmbH, 2001-2005"), gc); 62 contentPane.add(new JLabel("Licensed under the General Public License"), gc); 63 64 gc.weighty = 0; 65 gc.insets.top = 20; 66 gc.insets.bottom = 5; 67 gc.fill = GridBagConstraints.NONE; 68 contentPane.add(btnOk, gc); 69 70 Dimension size = contentPane.getPreferredSize(); 71 size.width += 100; 72 contentPane.setPreferredSize(size); 73 pack(); 74 setResizable(false); 75 76 } 77 78 private void setupControls() { 79 80 btnOk = new JButton("Ok"); 81 btnOk.addActionListener(new ActionListener () { 82 public void actionPerformed(ActionEvent event) { 83 setVisible(false); 84 dispose(); 85 } 86 }); 87 } 88 } 89 | Popular Tags |