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.32 by ajm, Thu Feb 14 16:50:10 2002 UTC

# Line 1 | Line 1
1   //---PACKAGE DECLARATION---
2 < package uk.ac.ukc.iscream.conient;
2 > package uk.org.iscream.cms.conient;
3  
4   //---IMPORTS---
5   import javax.swing.*;
# Line 28 | Line 28 | public class Conient extends JFrame {
28      /**
29       * The initial width of the window
30       */        
31 <    private final int DEFAULT_WIDTH = 600;
31 >    private final int DEFAULT_WIDTH = 700;
32      
33      /**
34       * The initial height of the window
# 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 <        Conient.addMessage("Conient {an i-scream Client} © 2001 University of Kent & Project i-scream");
77 >        conientFrame = (Frame) client;
78 >        Conient.addMessage("Conient {an i-scream Client} (c) 2001 The i-scream Project (http://www.i-scream.org.uk)");
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(JSplitPane 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 91 | Line 111 | public class Conient extends JFrame {
111  
112          // add the control pane to the top border
113          getContentPane().add(control, "North");
114 <        
115 <        // create a scrollable pane for the data in the centre
96 <        JScrollPane scrollPane = new JScrollPane(data);
97 <        getContentPane().add(scrollPane, "Center");
114 >        // add the data pane to the centre        
115 >        getContentPane().add(data);
116  
117          // setup the status panel        
118          JPanel bottom = new JPanel();
# Line 118 | Line 136 | public class Conient extends JFrame {
136          getContentPane().add(bottom, "South");
137          
138          // a nice icon for the window
139 <        setIconImage((new ImageIcon("./uk/ac/ukc/iscream/conient/server.gif")).getImage());
140 <        // show the window
139 >        setIconImage((new ImageIcon("./resources/server.gif")).getImage());
140 >
141 >        // and just because we can, a silly splash screen
142 >        // of the dudes that did this funky jibble
143 >        Splash splash = new Splash();
144 >        splash.show();
145 >        // wait
146 >        try {
147 >            Thread.sleep(DISPLAY_SPLASH_TIME_SECONDS * 1000);
148 >        } catch (InterruptedException e) {
149 >            // don't do anything, we don't care
150 >        }
151 >        //loose the window
152 >        splash.dispose();
153 >        splash = null;        
154 >        // show the main window
155          show();
156      }
157  
# Line 203 | Line 235 | public class Conient extends JFrame {
235      static JTextArea _messages = new JTextArea();
236      {
237          _messages.setLineWrap(true);
238 +    }
239 +    
240 +    /**
241 +     * Holds a reference to the root frame for Conient
242 +     * This is only used by dialogs (specifically the configurationn
243 +     * dialog) so that it can be modal, please use the accessor.
244 +     */
245 +    private static Frame conientFrame;
246 +    
247 + //---INNER CLASSES----
248 +
249 +    /**
250 +     * An inner class to display a splash screen
251 +     */
252 +    private class Splash extends JWindow {
253 +        
254 +        /**
255 +         * Constructs a new splash screen
256 +         */
257 +        public Splash() {
258 +            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
259 +            JPanel splash = new JPanel();
260 +            splash.setBackground(Color.black);
261 +            JLabel image = new JLabel((new ImageIcon("./resources/i-scream-splash.gif")));
262 +            splash.add(image);
263 +            setContentPane(splash);
264 +            Dimension screen = getToolkit().getScreenSize();
265 +            pack();
266 +            setLocation((screen.width - getSize().width) / 2,
267 +                        (screen.height - getSize().height) / 2);
268 +            
269 +            
270 +        }
271      }
272   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines