1 package zirc.base ; 2 3 import java.awt.* ; 4 import javax.swing.* ; 5 6 import zirc.gui.* ; 7 8 21 28 29 public class MainApp 30 { 31 private boolean packFrame = false ; 32 33 public MainApp() 35 { 36 MainFrame frame = new MainFrame() ; 37 if (packFrame) 40 { 41 frame.pack() ; 42 } 43 else 44 { 45 frame.validate() ; 46 } 47 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize() ; 49 Dimension frameSize = frame.getSize() ; 50 if (frameSize.height > screenSize.height) 51 { 52 frameSize.height = screenSize.height ; 53 } 54 if (frameSize.width > screenSize.width) 55 { 56 frameSize.width = screenSize.width ; 57 } 58 frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2) ; 59 frame.setVisible(true) ; 60 } 61 62 public static void main(String [] args) 64 { 65 try 66 { 67 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()) ; 68 } 69 catch (Exception ex) 70 { 71 ex.printStackTrace() ; 72 } 73 new MainApp() ; 74 } 75 } 76 | Popular Tags |