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.15 by ajm, Wed Jan 24 03:09:43 2001 UTC vs.
Revision 1.22 by ajm, Wed Feb 21 23:45:16 2001 UTC

# Line 16 | Line 16 | import java.awt.event.*;
16   * @author  $Author$
17   * @version $Id$
18   */
19 < public class SwingClient extends JFrame {
19 > public class Conient extends JFrame {
20  
21   //---FINAL ATTRIBUTES---
22  
# Line 36 | Line 36 | public class SwingClient extends JFrame {
36      private final int DEFAULT_HEIGHT = 600;
37      
38      /**
39 <     * The i-scream server port
39 >     * The default configuration fle
40 >     * This can be specified on the command line
41       */
42 <    public static final int PORT = 4510;
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 51 | Line 58 | public class SwingClient extends JFrame {
58      public static void main(String[] args) {
59          // get the host from the command line if they gave it
60          String host = null;
61 +        String configFile = DEFAULT_CONFIG_FILE;
62          if (args.length == 1) {
63 <            host = args[0];
63 >            configFile = args[0];
64          }
65 +
66 +        // start the configuration system
67 +        Configuration.initialise(configFile);
68  
69          // the data display panel
70          DataPanel data = new DataPanel();
# Line 62 | Line 73 | public class SwingClient extends JFrame {
73          ControlPanel control = new ControlPanel(data);
74          
75          // the main frame (passed the two panels)
76 <        SwingClient client = new SwingClient(data, control);
77 <        SwingClient.addMessage("Conient {an I-scream Client} © 2001 University of Kent & Project I-Scream");
78 <        SwingClient.addMessage("Conient ready.");
76 >        Conient client = new Conient(data, control);
77 >        Conient.addMessage("Conient {an i-scream Client} © 2001 University of Kent & Project i-scream");
78 >
79 >        Conient.addMessage("Conient ready.");
80 >        
81      }
82  
83      
# Line 73 | Line 86 | public class SwingClient extends JFrame {
86      /**
87       * Creates a new Swing Client Frame
88       */
89 <    private SwingClient(JPanel data, JPanel control) {
89 >    private Conient(JPanel data, JPanel control) {
90          // set up the Frame
91 <        super("Conient {an I-scream Client}");
91 >        super("Conient {an i-scream Client}");
92          setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
93  
94          // set what happens when the X in the corner is clicked        
# Line 100 | Line 113 | public class SwingClient extends JFrame {
113          bottom.add(messagesPane, "Center");
114          JPanel statusPanel = new JPanel();
115          JPanel linkPanel = new JPanel();
116 <        linkPanel.setLayout(new GridLayout(2,1));
116 >        linkPanel.setLayout(new GridLayout(1,2));
117          linkPanel.add(_controlStatus);
118          linkPanel.add(_dataStatus);
119 <        statusPanel.setLayout(new GridLayout(1,3));
119 >        statusPanel.setLayout(new GridLayout(2,1));
120          statusPanel.add(linkPanel);
121          statusPanel.add(_queueStatus);
122          bottom.add(statusPanel, "South");
# Line 111 | Line 124 | public class SwingClient extends JFrame {
124          // add the status panel to the bottom border
125          getContentPane().add(bottom, "South");
126          
127 <        // show the window
127 >        // a nice icon for the window
128 >        setIconImage((new ImageIcon("./uk/ac/ukc/iscream/conient/server.gif")).getImage());
129 >
130 >        // and just because we can, a silly splash screen
131 >        // of the dudes that did this funky gibble
132 >        Splash splash = new Splash();
133 >        splash.show();
134 >        // wait
135 >        try {
136 >            Thread.sleep(DISPLAY_SPLASH_TIME_SECONDS * 1000);
137 >        } catch (InterruptedException e) {
138 >            // don't do anything, we don't care
139 >        }
140 >        //loose the window
141 >        splash.dispose();
142 >        splash = null;        
143 >        // show the main window
144          show();
145      }
146  
# Line 193 | Line 222 | public class SwingClient extends JFrame {
222       * The place where system messages are written.
223       */
224      static JTextArea _messages = new JTextArea();
225 +    {
226 +        _messages.setLineWrap(true);
227 +    }
228 +    
229 + //---INNER CLASSES----
230 +
231 +    /**
232 +     * An inner class to display a splash screen
233 +     */
234 +    private class Splash extends JWindow {
235 +        
236 +        /**
237 +         * Constructs a new splash screen
238 +         */
239 +        public Splash() {
240 +            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
241 +            JPanel splash = new JPanel();
242 +            splash.setBackground(Color.black);
243 +            JLabel image = new JLabel((new ImageIcon("./uk/ac/ukc/iscream/conient/i-scream-splash.gif")));
244 +            splash.add(image);
245 +            setContentPane(splash);
246 +            Dimension screen = getToolkit().getScreenSize();
247 +            pack();
248 +            setLocation((screen.width - getSize().width) / 2,
249 +                        (screen.height - getSize().height) / 2);
250 +            
251 +            
252 +        }
253 +    }
254   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines