private void multiConnect() { if (jButtonMultiConnect.getText().equals("Multi-Connect")) { String res = JOptionPane.showInputDialog(this, "Enter number of connections", "Multi-Connect"); if (res != null) { jButtonMultiConnect.setText("Multi-Disconnect"); jMenuItemTestMulticonnect.setEnabled(false); jMenuItemTestMultidisconnect.setEnabled(true); int count = Integer.parseInt(res); MultiSessions = new Session[count]; for (int i = 0; i < count; i++) { MultiSessions[i] = new Session(); try { MultiSessions[i].connect( this.jTextFieldServer.getText(), this.jTextFieldUser.getText() + String.valueOf(i)); } catch (ConnectionException ex1) { } } } } else { for (int i = 0; i < MultiSessions.length; i++) { try { ((Session) MultiSessions[i]).disconnect(); } catch (Exception ex) { System.out.println("Error disconnectiong from session"); } } jButtonMultiConnect.setText("Multi-Connect"); jMenuItemTestMulticonnect.setEnabled(true); jMenuItemTestMultidisconnect.setEnabled(false); } }
public void jButtonStop_actionPerformed(ActionEvent e) { jButtonStart.setEnabled(true); server.interrupt(); connections(0); statusBar.setText("Server stopped!"); jButtonStop.setEnabled(false); jButtonConfig.setEnabled(false); }
private void jbInit() throws Exception { panel1.setLayout(xYLayout1); panel1.setBackground(new Color(251, 236, 175)); jToggleButton5.setText("Done"); jToggleButton5.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jToggleButton5_actionPerformed(e); } }); jLabel1.setToolTipText(""); jList1.addMouseListener( new java.awt.event.MouseAdapter() { public void mouseClicked(MouseEvent e) { jList1_mouseClicked(e); } }); HireFire.setText("Hire/Fire"); HireFire.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { HireFire_actionPerformed(e); } }); jButtonAdvertise.setText("Advertise"); jButtonAdvertise.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jButtonAdvertise_actionPerformed(e); } }); jTextFieldWage.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { jTextFieldWage_actionPerformed(e); } }); jLabel3.setHorizontalAlignment(SwingConstants.RIGHT); jLabel3.setText("Amount"); jLabel5.setText("jLabel5"); jTextFieldWage.setText("100"); panel1.add(jList1, new XYConstraints(9, 10, 206, 250)); panel1.add(jTextPane2, new XYConstraints(9, 262, 467, 109)); panel1.add(jLabel1, new XYConstraints(476, 9, 10, 226)); panel1.add(jLabel2, new XYConstraints(2, 454, 58, 12)); panel1.add(jToggleButton5, new XYConstraints(385, 397, 75, 26)); panel1.add(HireFire, new XYConstraints(9, 429, 134, 26)); panel1.add(jPanel1, new XYConstraints(217, 10, 259, 250)); this.getContentPane().add(panel1, BorderLayout.SOUTH); panel1.add(jButtonAdvertise, new XYConstraints(183, 401, 116, -1)); panel1.add(jTextFieldWage, new XYConstraints(69, 403, 102, 24)); panel1.add(jLabel3, new XYConstraints(19, 400, 46, 29)); panel1.add(jLabel4, new XYConstraints(155, 460, 44, 6)); panel1.add(jLabel5, new XYConstraints(507, 92, 5, 47)); this.setVisible(true); }
public void jButtonStart_actionPerformed(ActionEvent e) { GregorianCalendar now = new GregorianCalendar(); if (now.before(new GregorianCalendar(2005, 12, 31))) { jButtonStop.setEnabled(true); server = new Server(this); server.start(); // System.out.println(System.getProperty("sun.boot.class.path")); statusBar.setText("Server is running..."); jButtonStart.setEnabled(false); jButtonConfig.setEnabled(false); } else { JOptionPane.showMessageDialog( this, "Evaluation License has expired or is obsolete;\nplease contact vendor for renewal.", "License Error", JOptionPane.ERROR_MESSAGE); } }
/** * Component initialization. * * @throws java.lang.Exception */ private void jbInit() throws Exception { contentPane = (JPanel) getContentPane(); contentPane.setLayout(xYLayoutServer); setSize(new Dimension(365, 327)); setTitle("ProgDan® Codename Avalon: Parser Server v. 0.1"); statusBar.setBorder(BorderFactory.createLoweredBevelBorder()); statusBar.setText("Server stopped!"); jPanelFiles.setBorder(BorderFactory.createEtchedBorder()); jPanelFiles.setToolTipText(""); jPanelFiles.setLayout(xYLayout1); jLabelFiles.setFont(new java.awt.Font("Dialog", Font.BOLD, 11)); jLabelFiles.setText("Files received:"); jLabelConverted.setText("Files converted:"); jProgressBarConvert.setMaximum(0); jProgressBarConvert.setString("0"); jProgressBarConvert.setStringPainted(true); jLabelNoConvert.setText("Files not converted:"); jProgressBarNoConvert.setMaximum(0); jProgressBarNoConvert.setString("0"); jProgressBarNoConvert.setStringPainted(true); jProgressBarNoConvert.addPropertyChangeListener( new FrameServer_jProgressBarNoConvert_propertyChangeAdapter(this)); jButtonStart.setSelected(false); jButtonStart.setText("Start"); jButtonStart.addActionListener(new FrameServer_jButtonStart_actionAdapter(this)); jButtonStop.setEnabled(false); jButtonStop.setText("Stop"); jButtonStop.addActionListener(new FrameServer_jButtonStop_actionAdapter(this)); jButtonExit.setText("Exit"); jButtonExit.addActionListener(new FrameServer_jButtonExit_actionAdapter(this)); jButtonConfig.setText("Config"); jButtonConfig.addActionListener(new FrameServer_jButtonConfig_actionAdapter(this)); jLabelActiveConnections.setText("Active Connections:"); jTextFieldConnections.setEditable(false); jTextFieldConnections.setText("0"); jTextFieldConnections.setHorizontalAlignment(SwingConstants.CENTER); jProgressBarFiles.setMaximum(0); jProgressBarFiles.setString("0"); jProgressBarFiles.setStringPainted(true); jButtonText.setEnabled(false); jButtonText.setText("..."); jButtonText.addActionListener(new FrameServer_jButtonText_actionAdapter(this)); jPanelLogo.setBorder(null); jPanelLogo.setMinimumSize(new Dimension(10, 10)); jPanelLogo.setPreferredSize(new Dimension(10, 10)); jPanelLogo.setLayout(null); jLabelTitle.setFont(new java.awt.Font("Dialog", Font.BOLD, 14)); jLabelTitle.setText("ProgDan® Codename Avalon"); jLabelApplication.setFont(new java.awt.Font("Dialog", Font.BOLD, 24)); jLabelApplication.setForeground(Color.red); jLabelApplication.setText("Parser Server"); jLabelRelease.setFont(new java.awt.Font("Dialog", Font.BOLD, 11)); jLabelRelease.setForeground(Color.red); jLabelRelease.setText("Release 0.1 - Beta"); jLabelCopyright.setText("Copyright 2004-2005 - ProgDan® Software"); jPanelFiles.add(jLabelFiles, new XYConstraints(8, 5, -1, -1)); jPanelFiles.add(jLabelNoConvert, new XYConstraints(8, 50, -1, -1)); jPanelFiles.add(jLabelConverted, new XYConstraints(8, 28, -1, -1)); jPanelFiles.add(jProgressBarFiles, new XYConstraints(108, 3, 160, -1)); jPanelFiles.add(jProgressBarConvert, new XYConstraints(108, 26, 160, -1)); jPanelFiles.add(jProgressBarNoConvert, new XYConstraints(108, 48, 160, -1)); jPanelFiles.add(jButtonText, new XYConstraints(279, 46, -1, -1)); contentPane.add(jTextFieldConnections, new XYConstraints(158, 118, 131, -1)); contentPane.add(jLabelActiveConnections, new XYConstraints(45, 121, -1, -1)); contentPane.add(jButtonExit, new XYConstraints(277, 238, 65, -1)); contentPane.add(jButtonStart, new XYConstraints(11, 238, 65, -1)); contentPane.add(jButtonStop, new XYConstraints(100, 238, 65, -1)); contentPane.add(jButtonConfig, new XYConstraints(188, 238, 65, -1)); contentPane.add(statusBar, new XYConstraints(6, 272, 344, -1)); contentPane.add(jPanelFiles, new XYConstraints(13, 148, 327, 77)); contentPane.add(jPanelLogo, new XYConstraints(13, 15, 112, 96)); contentPane.add(jLabelTitle, new XYConstraints(141, 14, -1, -1)); contentPane.add(jLabelApplication, new XYConstraints(165, 40, -1, -1)); contentPane.add(jLabelRelease, new XYConstraints(250, 66, -1, -1)); contentPane.add(jLabelCopyright, new XYConstraints(137, 95, -1, -1)); }
public void jProgressBarNoConvert_propertyChange(PropertyChangeEvent evt) { jButtonText.setEnabled(jProgressBarNoConvert.getValue() > 0); }
public void jButtonExit_actionPerformed(ActionEvent e) { if (jButtonStop.isEnabled()) { jButtonStop_actionPerformed(e); } System.exit(0); }
private void jbInit() throws Exception { border1 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151)); border2 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151)); border3 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178)); titledBorder1 = new TitledBorder(border3, "Subject"); border4 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178)); titledBorder2 = new TitledBorder(border4, "Message"); border5 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178)); titledBorder3 = new TitledBorder(border5, "Subject"); border6 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151)); titledBorder4 = new TitledBorder(border6, "Message"); border7 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151)); titledBorder5 = new TitledBorder(border7, "Messages"); border8 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(165, 163, 151)); titledBorder6 = new TitledBorder(border8, "Online Users"); border9 = new EtchedBorder(EtchedBorder.RAISED, Color.white, new Color(178, 178, 178)); titledBorder7 = new TitledBorder(border9, "Send Message"); this.getContentPane().setLayout(borderLayout1); jSplitPane1.setOrientation(JSplitPane.VERTICAL_SPLIT); jSplitPane1.setBorder(border1); jSplitPane1.setLastDividerLocation(250); jSplitPane1.setResizeWeight(1.0); jLabelServer.setRequestFocusEnabled(true); jLabelServer.setText("Server"); jLabelUserId.setText("User Id"); jTextFieldServer.setPreferredSize(new Dimension(75, 20)); jTextFieldServer.setText(""); jTextFieldUser.setPreferredSize(new Dimension(75, 20)); jTextFieldUser.setText(""); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setJMenuBar(jMenuBarMain); this.setTitle("Message Client"); jLabeltargetUser.setText("Target"); jTextFieldTargetUser.setPreferredSize(new Dimension(75, 20)); jTextFieldTargetUser.setText(""); jPanelSendMessages.setBorder(border2); jPanelSendMessages.setMaximumSize(new Dimension(32767, 32767)); jPanelSendMessages.setOpaque(false); jPanelSendMessages.setPreferredSize(new Dimension(96, 107)); jPanelSendMessages.setRequestFocusEnabled(true); jPanelSendMessages.setToolTipText(""); jPanelSendMessages.setLayout(verticalFlowLayout1); jTextFieldSendSubject.setBorder(titledBorder3); jTextFieldSendSubject.setText(""); jTextFieldSendSubject.addKeyListener(new Client_jTextFieldSendSubject_keyAdapter(this)); jSplitPane2.setOrientation(JSplitPane.HORIZONTAL_SPLIT); jScrollPane1.setBorder(titledBorder5); jScrollPane2.setBorder(titledBorder6); jToggleButtonRegister.setText("Register"); jToggleButtonRegister.addActionListener(new Client_jToggleButtonRegister_actionAdapter(this)); jButtonMultiConnect.setText("Multi-Connect"); jButtonMultiConnect.addActionListener(new Client_jButtonMultiConnect_actionAdapter(this)); jListOnlineUsers.addMouseListener(new Client_jListOnlineUsers_mouseAdapter(this)); jToggleButtonConnect.setText("Connect"); jToggleButtonConnect.addActionListener(new Client_jToggleButtonConnect_actionAdapter(this)); jTextPaneDisplayMessages.setEditable(false); jTextPaneDisplayMessages.addMouseListener( new Client_jTextPaneDisplayMessages_mouseAdapter(this)); jTextFieldSendMessages.setBorder(titledBorder7); jTextFieldSendMessages.setToolTipText(""); jTextFieldSendMessages.addKeyListener(new Client_jTextFieldSendMessages_keyAdapter(this)); jButtonMessageStresser.setText("Msg Stresser"); jButtonMessageStresser.addActionListener( new Client_jToggleButtonMessageStresser_actionAdapter(this)); jMenuItemClearMessages.setText("Clear Messages"); jMenuItemClearMessages.addActionListener(new Client_jMenuItemClearMessages_actionAdapter(this)); jMenuServer.setText("Server"); jMenuItemServerConnect.setText("Connect"); jMenuItemServerConnect.addActionListener(new Client_jMenuItemServerConnect_actionAdapter(this)); jMenuItemServerDisconnect.setText("Disconnect"); jMenuItemServerDisconnect.addActionListener( new Client_jMenuItemServerDisconnect_actionAdapter(this)); jMenuOptions.setText("Options"); jMenuTest.setText("Test"); jMenuItemOptionsRegister.setText("Register"); jMenuItemOptionsRegister.addActionListener( new Client_jMenuItemOptionsRegister_actionAdapter(this)); jMenuItemOptionsDeregister.setText("Deregister"); jMenuItemOptionsDeregister.addActionListener( new Client_jMenuItemOptionsDeregister_actionAdapter(this)); jMenuItemOptionsEavesdrop.setText("Eavesdrop"); jMenuItemOptionsEavesdrop.addActionListener( new Client_jMenuItemOptionsEavesdrop_actionAdapter(this)); jMenuItemOptionsUneavesdrop.setText("Uneavesdrop"); jMenuItemOptionsUneavesdrop.addActionListener( new Client_jMenuItemOptionsUneavesdrop_actionAdapter(this)); jMenuItemTestMulticonnect.setText("Multiconnect"); jMenuItemTestMulticonnect.addActionListener( new Client_jMenuItemTestMulticonnect_actionAdapter(this)); jMenuItemTestMessageStresser.setText("Message Stresser"); jMenuItemTestMessageStresser.addActionListener( new Client_jMenuItemTestMessageStresser_actionAdapter(this)); jMenuItemTestMultidisconnect.setText("Multidisconnect"); jMenuItemTestMultidisconnect.addActionListener( new Client_jMenuItemTestMultidisconnect_actionAdapter(this)); jMenuItemOptionsGlobalEavesdrop.setText("Global Eavesdrop"); jMenuItemOptionsGlobalEavesdrop.addActionListener( new Client_jMenuItemOptionsGlobalEavesdrop_actionAdapter(this)); jMenuItemOptionsGlobalUneavesdrop.setEnabled(false); jMenuItemOptionsGlobalUneavesdrop.setText("Global Uneavesdrop"); jMenuItemOptionsGlobalUneavesdrop.addActionListener( new Client_jMenuItemOptionsGlobalUneavesdrop_actionAdapter(this)); jLabelPwd.setText("Pwd"); jPasswordFieldPwd.setMinimumSize(new Dimension(11, 20)); jPasswordFieldPwd.setPreferredSize(new Dimension(75, 20)); jPasswordFieldPwd.setText(""); jMenuItemScheduleCommand.setText("Schedule Command"); jMenuItemScheduleCommand.addActionListener( new Client_jMenuItemScheduleCommand_actionAdapter(this)); jMenuItemEditScheduledCommands.setText("Edit Scheduled Commands"); jMenuItemEditScheduledCommands.addActionListener( new Client_jMenuItemEditScheduledCommands_actionAdapter(this)); jPanelSendMessages.add(jTextFieldSendSubject, null); jPanelSendMessages.add(jTextFieldSendMessages, null); jSplitPane1.add(jSplitPane2, JSplitPane.TOP); jSplitPane2.add(jScrollPane1, JSplitPane.TOP); jScrollPane1.getViewport().add(jTextPaneDisplayMessages, null); jSplitPane2.add(jScrollPane2, JSplitPane.BOTTOM); jScrollPane2.getViewport().add(jListOnlineUsers, null); this.getContentPane().add(jSplitPane1, BorderLayout.CENTER); jSplitPane1.add(jPanelSendMessages, JSplitPane.BOTTOM); this.getContentPane().add(jPanel1, BorderLayout.NORTH); jPanel1.add(jLabelServer, null); jPanel1.add(jTextFieldServer, null); jPanel1.add(jLabelUserId, null); jPanel1.add(jTextFieldUser, null); jPanel1.add(jLabelPwd, null); jPanel1.add(jPasswordFieldPwd, null); jPanel1.add(jLabeltargetUser, null); jPanel1.add(jTextFieldTargetUser, null); jPanel1.add(jToggleButtonConnect, null); jPanel1.add(jToggleButtonRegister, null); jPanel1.add(jButtonMultiConnect, null); jPanel1.add(jButtonMessageStresser, null); jPopupMenuMessageArea.add(jMenuItemClearMessages); jMenuBarMain.add(jMenuServer); jMenuBarMain.add(jMenuOptions); jMenuBarMain.add(jMenuTest); jMenuServer.add(jMenuItemServerConnect); jMenuServer.add(jMenuItemServerDisconnect); jMenuOptions.add(jMenuItemOptionsRegister); jMenuOptions.add(jMenuItemOptionsDeregister); jMenuOptions.add(jMenuItemOptionsEavesdrop); jMenuOptions.add(jMenuItemOptionsUneavesdrop); jMenuOptions.add(jMenuItemOptionsGlobalEavesdrop); jMenuOptions.add(jMenuItemOptionsGlobalUneavesdrop); jMenuTest.add(jMenuItemTestMulticonnect); jMenuTest.add(jMenuItemTestMultidisconnect); jMenuTest.add(jMenuItemTestMessageStresser); jMenuTest.add(jMenuItemScheduleCommand); jMenuTest.add(jMenuItemEditScheduledCommands); jSplitPane1.setDividerLocation(200); jSplitPane2.setDividerLocation(600); jListOnlineUsers.setCellRenderer(new OnlineListCellRenderer()); jListOnlineUsers.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); jMenuItemTestMulticonnect.setEnabled(true); jMenuItemTestMultidisconnect.setEnabled(false); jMenuItemServerConnect.setEnabled(true); jMenuItemServerDisconnect.setEnabled(false); jMenuItemOptionsRegister.setEnabled(true); jMenuItemOptionsDeregister.setEnabled(false); }