1 package com.piratepete.dbpirate; 2 3 import java.awt.BorderLayout ; 4 import java.awt.event.KeyEvent ; 5 6 import javax.swing.Action ; 7 import javax.swing.ImageIcon ; 8 import javax.swing.*; 9 10 import com.piratepete.dbpirate.ui.MainWindow; 11 import com.piratepete.dbpirate.ui.MainToolBar; 12 import com.piratepete.dbpirate.ui.MainMenu; 13 import com.piratepete.dbpirate.ui.SplashScreen; 14 15 import com.piratepete.dbpirate.ui.actions.NewConnectionAction; 16 17 40 public class DBPirate { 41 42 public static ApplicationManager appManager = null; 43 44 48 public DBPirate() 49 { 50 appManager = new ApplicationManager(); 52 53 splash = new SplashScreen(); 55 56 for(int i = 0; i < 7; i++) { 58 updateStatus(i); 59 try { 60 Thread.sleep(500); 61 } catch (InterruptedException ie) { 62 ie.printStackTrace(); 63 } 64 } 65 66 MainWindow appWindow = new MainWindow("DBPirate v1.0a"); 68 appWindow.setPLAF(); 69 70 MainMenu appMenu = new MainMenu(actions, appWindow); 72 MainToolBar toolbar = new MainToolBar(actions); 73 74 JPanel contentPane = new JPanel(); 76 contentPane.setLayout(new BorderLayout ()); 77 appWindow.setContentPane(contentPane); 78 79 desktop = new JDesktopPane(); contentPane.add(desktop, BorderLayout.CENTER); 82 contentPane.add(toolbar, BorderLayout.NORTH); 83 appWindow.setContentPane(contentPane); 84 setBackgroundImage(desktop); 85 86 appWindow.setJMenuBar(appMenu); 87 appWindow.setVisible(true); 89 appWindow.Maximize(); 90 91 hideSplashScreen(); 93 splash = null; 94 95 } 96 97 101 public static void hideSplashScreen() 102 { 103 if(splash != null) 104 { 105 splash.dispose(); 106 splash = null; 107 } 108 } 109 110 114 public void updateStatus(int increment) { 115 if(splash != null) { 117 splash.advance(); 118 } 119 } 120 121 125 public static void main(String [] args) 126 { 127 DBPirate dbpirate = new DBPirate(); 128 129 } 131 132 136 protected void setBackgroundImage(JDesktopPane desktop) 137 { 138 ImageIcon icon = new ImageIcon (getClass().getResource("/com/piratepete/dbpirate/ui/images/flag.jpg")); 139 JLabel label = new JLabel(icon); 140 label.setBounds(0, 0, icon.getIconWidth(), icon.getIconHeight()); 141 desktop.add(label, new Integer (Integer.MIN_VALUE)); 142 } 143 144 145 149 private Action newConnectAction = new NewConnectionAction("New", 150 new ImageIcon (this.getClass().getClass().getResource("/com/piratepete/dbpirate/ui/images/connect.gif")), 151 "New Connection",new Integer (KeyEvent.VK_N)); 152 153 private Action [] actions = { newConnectAction }; 154 private JDesktopPane desktop; 155 private static SplashScreen splash; 156 157 } 158 | Popular Tags |