|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| Costello.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
package abbot.editor;
|
|
| 2 |
|
|
| 3 |
import java.awt.*;
|
|
| 4 |
|
|
| 5 |
import javax.swing.*;
|
|
| 6 |
import javax.swing.border.*;
|
|
| 7 |
|
|
| 8 |
import abbot.Platform;
|
|
| 9 |
import abbot.i18n.Strings;
|
|
| 10 |
|
|
| 11 |
/** Simple splash screen for the script editor. */
|
|
| 12 |
public class Costello { |
|
| 13 |
|
|
| 14 |
private static final String BUNDLE = "abbot.editor.i18n.StringsBundle"; |
|
| 15 |
|
|
| 16 |
static {
|
|
| 17 |
// Don't need robot verification
|
|
| 18 | 0 |
System.setProperty("abbot.robot.verify", "false"); |
| 19 | 0 |
System.setProperty("com.apple.mrj.application.apple.menu.about.name",
|
| 20 |
"Costello");
|
|
| 21 | 0 |
if (Platform.JAVA_VERSION < Platform.JAVA_1_4) {
|
| 22 |
// Mac OSX setup stuff
|
|
| 23 | 0 |
System.setProperty("com.apple.mrj.application.growbox.intrudes",
|
| 24 |
"true");
|
|
| 25 | 0 |
System.setProperty("com.apple.macos.use-file-dialog-packages", "true"); |
| 26 | 0 |
System.setProperty("com.apple.macos.useScreenMenuBar", "true"); |
| 27 |
} |
|
| 28 |
else {
|
|
| 29 | 0 |
System.setProperty("apple.laf.useScreenMenuBar", "true"); |
| 30 | 0 |
System.setProperty("apple.awt.showGrowBox", "true"); |
| 31 |
} |
|
| 32 | 0 |
Strings.addBundle(BUNDLE); |
| 33 |
} |
|
| 34 |
|
|
| 35 |
private static class SplashScreen extends JWindow { |
|
| 36 |
boolean disposeOK = false; |
|
| 37 | 0 |
public void hide() { |
| 38 | 0 |
if (disposeOK) {
|
| 39 | 0 |
super.hide();
|
| 40 |
} |
|
| 41 |
} |
|
| 42 | 0 |
public void dispose() { |
| 43 | 0 |
if (disposeOK) {
|
| 44 | 0 |
super.dispose();
|
| 45 |
} |
|
| 46 |
} |
|
| 47 |
} |
|
| 48 |
|
|
| 49 |
private static SplashScreen splash = null; |
|
| 50 | 0 |
public static Window getSplashScreen() { |
| 51 | 0 |
return splash;
|
| 52 |
} |
|
| 53 |
|
|
| 54 |
/** Note that this "main" is typical of many Swing apps, in that it does
|
|
| 55 |
window showing and disposal directly from the main thread. Running
|
|
| 56 |
the editor under itself should provide a reasonable test for handling
|
|
| 57 |
that scenario.
|
|
| 58 |
*/
|
|
| 59 | 0 |
public static void main(String[] args) { |
| 60 |
|
|
| 61 | 0 |
try {
|
| 62 | 0 |
String lafClass = |
| 63 |
System.getProperty("abbot.editor.look_and_feel", "system"); |
|
| 64 | 0 |
if ("system".equals(lafClass)) |
| 65 | 0 |
lafClass = UIManager.getSystemLookAndFeelClassName(); |
| 66 | 0 |
if (lafClass != null |
| 67 |
&& !"".equals(lafClass)
|
|
| 68 |
&& !"default".equals(lafClass))
|
|
| 69 | 0 |
UIManager.setLookAndFeel(lafClass); |
| 70 |
} |
|
| 71 |
catch(Exception e) {
|
|
| 72 |
} |
|
| 73 |
|
|
| 74 | 0 |
splash = new SplashScreen();
|
| 75 | 0 |
JLabel label = new LogoLabel();
|
| 76 |
// Add a beveled border on non-Mac platforms
|
|
| 77 | 0 |
if (!Platform.isOSX()) {
|
| 78 | 0 |
Border b = |
| 79 |
new CompoundBorder(new SoftBevelBorder(BevelBorder.RAISED), |
|
| 80 |
label.getBorder()); |
|
| 81 | 0 |
label.setBorder(b); |
| 82 |
} |
|
| 83 | 0 |
splash.getContentPane().add(label); |
| 84 | 0 |
splash.pack(); |
| 85 | 0 |
Dimension d = splash.getToolkit().getScreenSize(); |
| 86 | 0 |
Dimension size = splash.getSize(); |
| 87 | 0 |
Point loc = new Point((d.width - size.width) / 2,
|
| 88 |
(d.height - size.height) / 2); |
|
| 89 | 0 |
splash.setLocation(loc); |
| 90 | 0 |
splash.setVisible(true);
|
| 91 |
|
|
| 92 | 0 |
try {
|
| 93 | 0 |
ScriptEditor.main(args); |
| 94 |
} |
|
| 95 |
finally {
|
|
| 96 | 0 |
splash.disposeOK = true;
|
| 97 |
// NOTE: disposal in main still screws us up, because the dispose
|
|
| 98 |
// does an invokeAndWait...
|
|
| 99 | 0 |
java.awt.EventQueue.invokeLater(new Runnable() {
|
| 100 | 0 |
public void run() { splash.dispose(); splash = null; } |
| 101 |
}); |
|
| 102 |
} |
|
| 103 |
} |
|
| 104 |
} |
|
| 105 |
|
|
||||||||||