ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/conient/uk/org/iscream/cms/conient/Conient.java
(Generate patch)

Comparing projects/cms/source/conient/uk/org/iscream/cms/conient/Conient.java (file contents):
Revision 1.21 by ajm, Mon Feb 5 01:26:04 2001 UTC vs.
Revision 1.24 by ajm, Tue Feb 27 03:09:58 2001 UTC

# Line 41 | Line 41 | public class Conient extends JFrame {
41       */
42      public static final String DEFAULT_CONFIG_FILE = "./etc/default.conf";
43      
44 +    /**
45 +     * The time in seconds to display the splash
46 +     * screen for
47 +     */
48 +    public static final int DISPLAY_SPLASH_TIME_SECONDS = 3;
49 +    
50   //---STATIC METHODS---
51  
52      /**
# Line 68 | Line 74 | public class Conient extends JFrame {
74          
75          // the main frame (passed the two panels)
76          Conient client = new Conient(data, control);
77 +        conientFrame = (Frame) client;
78          Conient.addMessage("Conient {an i-scream Client} © 2001 University of Kent & Project i-scream");
79  
80          Conient.addMessage("Conient ready.");
81 +        
82      }
75
83      
84 +    /**
85 +     * A static accessor, allowing components of the system
86 +     * to get hold of the root frame of the system.
87 +     *
88 +     * see conientFrame attribute for details.
89 +     *
90 +     * @return the root Conient frame
91 +     */
92 +    public static Frame getFrame() {
93 +        return conientFrame;
94 +    }
95 +    
96   //---CONSTRUCTORS---
97  
98      /**
99       * Creates a new Swing Client Frame
100       */
101 <    private Conient(JPanel data, JPanel control) {
101 >    private Conient(JPanel data, ControlPanel control) {
102          // set up the Frame
103          super("Conient {an i-scream Client}");
104          setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
105 <
105 >        setJMenuBar(control.getMenuBar());
106 >        
107          // set what happens when the X in the corner is clicked        
108          addWindowListener(new WindowAdapter() {
109              public void windowClosing(WindowEvent e) {System.exit(0);}
# Line 119 | Line 139 | public class Conient extends JFrame {
139          
140          // a nice icon for the window
141          setIconImage((new ImageIcon("./uk/ac/ukc/iscream/conient/server.gif")).getImage());
142 <        // show the window
142 >
143 >        // and just because we can, a silly splash screen
144 >        // of the dudes that did this funky gibble
145 >        Splash splash = new Splash();
146 >        splash.show();
147 >        // wait
148 >        try {
149 >            Thread.sleep(DISPLAY_SPLASH_TIME_SECONDS * 1000);
150 >        } catch (InterruptedException e) {
151 >            // don't do anything, we don't care
152 >        }
153 >        //loose the window
154 >        splash.dispose();
155 >        splash = null;        
156 >        // show the main window
157          show();
158      }
159  
# Line 203 | Line 237 | public class Conient extends JFrame {
237      static JTextArea _messages = new JTextArea();
238      {
239          _messages.setLineWrap(true);
240 +    }
241 +    
242 +    /**
243 +     * Holds a reference to the root frame for Conient
244 +     * This is only used by dialogs (specifically the configurationn
245 +     * dialog) so that it can be modal, please use the accessor.
246 +     */
247 +    private static Frame conientFrame;
248 +    
249 + //---INNER CLASSES----
250 +
251 +    /**
252 +     * An inner class to display a splash screen
253 +     */
254 +    private class Splash extends JWindow {
255 +        
256 +        /**
257 +         * Constructs a new splash screen
258 +         */
259 +        public Splash() {
260 +            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
261 +            JPanel splash = new JPanel();
262 +            splash.setBackground(Color.black);
263 +            JLabel image = new JLabel((new ImageIcon("./uk/ac/ukc/iscream/conient/i-scream-splash.gif")));
264 +            splash.add(image);
265 +            setContentPane(splash);
266 +            Dimension screen = getToolkit().getScreenSize();
267 +            pack();
268 +            setLocation((screen.width - getSize().width) / 2,
269 +                        (screen.height - getSize().height) / 2);
270 +            
271 +            
272 +        }
273      }
274   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines