Rev 628 | Rev 657 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
628 | adamjking | 1 | import java.awt.Dimension; |
2 | import java.awt.Toolkit; |
||
3 | import java.awt.event.ActionEvent; |
||
4 | import java.awt.event.ActionListener; |
||
5 | import java.awt.event.KeyEvent; |
||
6 | import java.awt.event.WindowAdapter; |
||
7 | import java.awt.event.WindowEvent; |
||
8 | import java.util.Hashtable; |
||
9 | import java.util.prefs.Preferences; |
||
10 | |||
11 | import javax.swing.JDialog; |
||
12 | import javax.swing.JFrame; |
||
13 | import javax.swing.JMenuItem; |
||
14 | import javax.swing.UIManager; |
||
15 | |||
16 | import org.midibox.apps.miosstudiosid.gui.MIOSStudioSIDGUI; |
||
17 | import org.midibox.utils.gui.DialogOwner; |
||
18 | import org.midibox.utils.gui.ImageLoader; |
||
19 | import org.midibox.utils.gui.SplashScreen; |
||
20 | |||
21 | public class MIOSStudioSID extends MIOSStudio { |
||
22 | |||
641 | adamjking | 23 | protected static String frameTitle = "MIOS Studio + SIDV2 Librarian"; |
628 | adamjking | 24 | |
641 | adamjking | 25 | protected static String splashTitle = "MIOS Studio beta8.3 + SIDV2 Librarian"; |
628 | adamjking | 26 | |
27 | protected static String splashImage = "splash.jpg"; |
||
28 | |||
641 | adamjking | 29 | protected static String frameComment = "MIOS Studio beta8.3 + SIDV2 Librarian"; |
628 | adamjking | 30 | |
31 | public MIOSStudioSID() { |
||
32 | |||
33 | this.miosStudio = new org.midibox.apps.miosstudiosid.MIOSStudioSID(); |
||
34 | |||
35 | Preferences preferences = getPreferences(); |
||
36 | |||
37 | try { |
||
38 | UIManager.setLookAndFeel(preferences.get("lookAndFeel", UIManager |
||
39 | .getCrossPlatformLookAndFeelClassName())); |
||
40 | } catch (Exception e) { |
||
41 | System.out.println(e.toString()); |
||
42 | } |
||
43 | |||
44 | JDialog.setDefaultLookAndFeelDecorated(preferences.getBoolean( |
||
45 | "defaultDecoratedFrames", false)); |
||
46 | |||
47 | this.miosStudioGUI = new MIOSStudioSIDGUI( |
||
48 | (org.midibox.apps.miosstudiosid.MIOSStudioSID) miosStudio); |
||
49 | miosStudioGUI.setCommentLabel(frameComment); |
||
50 | |||
51 | this.windows = new Hashtable(); |
||
52 | setContentPane(miosStudioGUI); |
||
53 | setJMenuBar(miosStudioGUI.createMenuBar()); |
||
54 | } |
||
55 | |||
56 | protected Preferences getPreferences() { |
||
57 | |||
58 | return Preferences.userRoot().node("org/midibox/miostudiosid/gui"); |
||
59 | } |
||
60 | |||
61 | protected void createWindowsHashtable() { |
||
62 | super.createWindowsHashtable(); |
||
63 | |||
64 | windows.put("sidv2librarianWindow", ((MIOSStudioSIDGUI) miosStudioGUI) |
||
65 | .getSidv2librarianWindow()); |
||
66 | } |
||
67 | |||
68 | public static void main(String[] args) { |
||
69 | SplashScreen splashScreen = new SplashScreen(splashImage, splashTitle); |
||
70 | |||
71 | Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); |
||
72 | |||
73 | splashScreen.setLocation( |
||
74 | (screenSize.width - splashScreen.getWidth()) / 2, |
||
75 | (screenSize.height - splashScreen.getHeight()) / 2); |
||
76 | |||
77 | splashScreen.setVisible(true); |
||
78 | |||
79 | Preferences preferences = Preferences.userRoot().node( |
||
80 | "org/midibox/miostudiosid/gui"); |
||
81 | |||
82 | JFrame.setDefaultLookAndFeelDecorated(preferences.getBoolean( |
||
83 | "defaultDecoratedFrames", false)); |
||
84 | |||
85 | final JFrame frame = new JFrame(frameTitle); |
||
86 | |||
87 | DialogOwner.setFrame(frame); |
||
88 | |||
89 | final MIOSStudioSID miosStudioSID = new MIOSStudioSID(); |
||
90 | miosStudioSID.init(); |
||
91 | |||
92 | frame.setContentPane(miosStudioSID); |
||
93 | frame.setIconImage(ImageLoader.getImageIcon("ucIcon.png").getImage()); |
||
94 | |||
95 | frame.setBounds(preferences.getInt("mainWindowX", 50), preferences |
||
96 | .getInt("mainWindowY", 50), preferences.getInt( |
||
97 | "mainWindowWidth", (screenSize.width - 100)), preferences |
||
98 | .getInt("mainWindowHeight", (screenSize.height - 100))); |
||
99 | |||
100 | JMenuItem exitMenuItem = new JMenuItem("Exit"); |
||
101 | exitMenuItem.setMnemonic(KeyEvent.VK_X); |
||
102 | exitMenuItem.setActionCommand("exit"); |
||
103 | |||
104 | exitMenuItem.addActionListener(new ActionListener() { |
||
105 | public void actionPerformed(ActionEvent ae) { |
||
106 | miosStudioSID.destroy(); |
||
107 | miosStudioSID.exit(frame); |
||
108 | } |
||
109 | }); |
||
110 | |||
111 | miosStudioSID.miosStudioGUI.getFileMenu().add(exitMenuItem); |
||
112 | |||
113 | frame.addWindowListener(new WindowAdapter() { |
||
114 | public void windowClosing(WindowEvent we) { |
||
115 | miosStudioSID.destroy(); |
||
116 | miosStudioSID.exit(frame); |
||
117 | } |
||
118 | }); |
||
119 | |||
120 | frame.setVisible(true); |
||
121 | splashScreen.setVisible(false); |
||
122 | } |
||
123 | } |