public void updateStats() { // This just updates any statistics that are shown on the face of // the server window stats.setText( server.strings.get(thisClass, "connectionscurrent") + " " + server.currentConnections + " " + server.strings.get(thisClass, "connectionspeak") + " " + server.peakConnections + " " + server.strings.get(thisClass, "connectionstotal") + " " + server.totalConnections); return; }
public babylonServerWindow(babylonServer parent, String Name) { super(Name); server = parent; myLayout = new GridBagLayout(); setLayout(myLayout); p = new Panel(); p.setLayout(myLayout); listening = new Label(server.strings.get(thisClass, "listenport") + " " + server.port); p.add( listening, new babylonConstraints( 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); logChat = new Checkbox(server.strings.get(thisClass, "logchats"), server.logChats); logChat.addItemListener(this); p.add( logChat, new babylonConstraints( 1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); userList = new List(4, false); userList.addItemListener(this); p.add( userList, new babylonConstraints( 0, 1, 1, 5, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); userAdmin = new Button(server.strings.get(thisClass, "usermanagement")); userAdmin.addActionListener(this); p.add( userAdmin, new babylonConstraints( 1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); console = new Button(server.strings.get(thisClass, "adminclient")); console.addActionListener(this); p.add( console, new babylonConstraints( 1, 2, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); disconnect = new Button(server.strings.get(thisClass, "disconnectuser")); disconnect.setEnabled(false); disconnect.addActionListener(this); p.add( disconnect, new babylonConstraints( 1, 3, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); disconnectAll = new Button(server.strings.get(thisClass, "disconnectall")); disconnectAll.setEnabled(false); disconnectAll.addActionListener(this); p.add( disconnectAll, new babylonConstraints( 1, 4, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); shutdown = new Button(server.strings.get(thisClass, "shutdown")); shutdown.addActionListener(this); p.add( shutdown, new babylonConstraints( 1, 5, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); stats = new TextField( server.strings.get(thisClass, "connectionscurrent") + " 0 " + server.strings.get(thisClass, "connectionspeak") + " 0 " + server.strings.get(thisClass, "connectionstotal") + " 0", 40); stats.setEditable(false); p.add( stats, new babylonConstraints( 0, 7, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); logWindow = new TextArea( server.strings.get(thisClass, "activitylog") + "\n", 10, 40, TextArea.SCROLLBARS_VERTICAL_ONLY); logWindow.setEditable(false); p.add( logWindow, new babylonConstraints( 0, 8, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0, 0)); canvas = new babylonPictureCanvas(this); p.add( canvas, new babylonConstraints( 0, 9, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); add( p, new babylonConstraints( 0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); try { URL url = new URL("file", "localhost", "babylonPic.jpg"); Image image = getToolkit().getImage(url); canvas.setimage(image); } catch (Exception e) { System.out.println(e); } try { URL iconUrl = new URL("file", "localhost", "babylonIcon.jpg"); ImageIcon icon = new ImageIcon(iconUrl); this.setIconImage(icon.getImage()); } catch (Exception e) { /* Not important */ } addWindowListener(this); setSize(600, 600); pack(); }