1 14 package org.compiere.install; 15 16 import java.awt.*; 17 import java.awt.event.*; 18 import java.util.*; 19 20 import javax.swing.*; 21 22 28 public class Setup extends JFrame implements ActionListener 29 { 30 33 public Setup() 34 { 35 enableEvents(AWTEvent.WINDOW_EVENT_MASK); 36 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 37 try 38 { 39 jbInit(); 40 } 41 catch(Exception e) 42 { 43 e.printStackTrace(); 44 System.exit(1); 45 } 46 47 48 pack(); 49 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 51 Dimension frameSize = this.getSize(); 52 if (frameSize.height > screenSize.height) 53 frameSize.height = screenSize.height; 54 if (frameSize.width > screenSize.width) 55 frameSize.width = screenSize.width; 56 setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); 57 setVisible(true); 58 } 60 61 static ResourceBundle res = ResourceBundle.getBundle("org.compiere.install.SetupRes"); 63 private JPanel contentPane; 64 private JMenuBar menuBar = new JMenuBar(); 65 private JMenu menuFile = new JMenu(); 66 private JMenuItem menuFileExit = new JMenuItem(); 67 private JMenu menuHelp = new JMenu(); 68 private JMenuItem menuHelpInfo = new JMenuItem(); 69 private JLabel statusBar = new JLabel(); 70 private BorderLayout borderLayout = new BorderLayout(); 71 private JPanel configurationPanel = new JPanel(); 72 73 77 private void jbInit() throws Exception 78 { 79 contentPane = (JPanel) this.getContentPane(); 81 contentPane.setLayout(borderLayout); 82 configurationPanel = new ConfigurationPanel(statusBar); 83 84 this.setTitle(res.getString("CompiereServerSetup")); 85 statusBar.setBorder(BorderFactory.createLoweredBevelBorder()); 86 statusBar.setText(" "); 87 menuFile.setText(res.getString("File")); 88 menuFileExit.setText(res.getString("Exit")); 89 menuFileExit.addActionListener(this); 90 menuHelp.setText(res.getString("Help")); 91 menuHelpInfo.setText(res.getString("Help")); 92 menuHelpInfo.addActionListener(this); 93 borderLayout.setHgap(5); 94 borderLayout.setVgap(5); 95 menuFile.add(menuFileExit); 96 menuHelp.add(menuHelpInfo); 97 menuBar.add(menuFile); 98 menuBar.add(menuHelp); 99 this.setJMenuBar(menuBar); 100 contentPane.add(statusBar, BorderLayout.SOUTH); 101 contentPane.add(configurationPanel, BorderLayout.CENTER); 102 } 104 108 public void actionPerformed(ActionEvent e) 109 { 110 if (e.getSource() == menuFileExit) 111 System.exit(0); 112 else if (e.getSource() == menuHelpInfo) 113 new Setup_Help(this); 114 } 116 117 121 public static void main(String [] args) 122 { 123 new Setup(); 125 } 127 } | Popular Tags |