private void changeUnits() { String len = _length.getText(); if (len == null || len.length() == 0) { if (_block.isMetric()) { _units.setText("cm"); } else { _units.setText("in"); } return; } try { float f = Float.parseFloat(len); if (_units.isSelected()) { _length.setText(Float.toString(f / 2.54f)); _units.setText("in"); } else { _length.setText(Float.toString(f * 2.54f)); _units.setText("cm"); } } catch (NumberFormatException nfe) { JOptionPane.showMessageDialog( this, Bundle.getMessage("MustBeFloat", len), Bundle.getMessage("makePath"), JOptionPane.INFORMATION_MESSAGE); } }
@Override public void mouseClicked(MouseEvent e) { if (tglbtnMouseMode.isSelected()) { tglbtnMouseMode.setText("Mode: Draw"); globeDisplayAdapter.setArmed(true); mapDisplayAdapter.setArmed(true); mapSelectionList.setEnabled(false); slider.setEnabled(false); btnStep.setEnabled(false); btnStepToMarker.setEnabled(false); resumeValue = -1; int diff = slider.getMaximum() - dbgPosIndex; if (diff != 0) { resumeValue = dbgPosIndex; nDebugSteps(diff); } } else { tglbtnMouseMode.setText("Mode: Move"); globeDisplayAdapter.setArmed(false); mapDisplayAdapter.setArmed(false); mapSelectionList.setEnabled(true); slider.setEnabled(true); btnStep.setEnabled(true); btnStepToMarker.setEnabled(true); if (resumeValue != -1) resetToIndex(resumeValue); } }
public void actionPerformed(ActionEvent e) { boolean isOffline = !Main.pref.getBoolean(ConfigKeys.OSB_API_OFFLINE); // inform the dialog about the connection mode dialog.setConnectionMode(isOffline); // set the new value in the preferences Main.pref.put(ConfigKeys.OSB_API_OFFLINE, isOffline); // toggle the tooltip text if (e.getSource() != null && e.getSource() instanceof JToggleButton) { JToggleButton button = (JToggleButton) e.getSource(); if (isOffline) { button.setToolTipText(MSG_ONLINE); if (Main.pref.getBoolean(ConfigKeys.OSB_BUTTON_LABELS)) { button.setText(MSG_ONLINE); } } else { button.setToolTipText(MSG_OFFLINE); if (Main.pref.getBoolean(ConfigKeys.OSB_BUTTON_LABELS)) { button.setText(MSG_OFFLINE); } } } if (!isOffline) { if (actionQueue.getSize() == 0) { dialog.hideQueuePanel(); return; } // if we switch to online mode, ask if the queue should be processed int result = JOptionPane.showConfirmDialog( Main.parent, tr("You have unsaved changes in your queue. Do you want to submit them now?"), tr("OpenStreetBugs"), JOptionPane.YES_NO_OPTION); if (result == JOptionPane.YES_OPTION) { try { actionQueue.processQueue(); // toggle queue panel visibility, if now error occurred dialog.hideQueuePanel(); // refresh, if the api is enabled if (!Main.pref.getBoolean(ConfigKeys.OSB_API_DISABLED)) { plugin.updateData(); } } catch (Exception e1) { System.err.println("Couldn't process action queue"); e1.printStackTrace(); } } } else { dialog.showQueuePanel(); } }
private void disconnect() { if (session != null && session.isConnected()) { session.disconnect(); } jToggleButtonConnect.setSelected(false); jToggleButtonConnect.setText("Connect"); jToggleButtonRegister.setSelected(false); onlineUsers.clear(); jToggleButtonRegister.setText("Register"); }
public void updateAdvancedOptionsStatus(boolean b) { jPanelReturnType.setVisible(b); jLabelAdv1.setVisible(b); jLabelAdv2.setVisible(b); jComboBoxType1.setVisible(b); jComboBoxType2.setVisible(b); if (b) { jToggleButton1.setText(I18n.getString("FewerOptions", "Fewer options")); } else { jToggleButton1.setText(I18n.getString("MoreOptions", "More options")); } }
private void addButtonToPropertySheetPanel() { showAllVPButton = new JToggleButton(); showAllVPButton.setText("Show All"); showAllVPButton.setToolTipText("Show all Visual Properties"); showAllVPButton.setSelected(PropertySheetUtil.isAdvancedMode()); showAllVPButton.setUI(new BlueishButtonUI()); showAllVPButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { viewModeAction.menuSelected(null); viewModeAction.actionPerformed(null); } }); // This is a hack: get private component and add button. Field[] fields = PropertySheetPanel.class.getDeclaredFields(); for (Field f : fields) { if (f.getName().equals("actionPanel")) { f.setAccessible(true); try { JPanel buttonPanel = (JPanel) f.get(propertySheetPanel); buttonPanel.add(showAllVPButton); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } } }
private JToggleButton getJToggleButton2() { if (jToggleButton2 == null) { jToggleButton2 = new JToggleButton(); jToggleButton2.setText("勝ち"); } return jToggleButton2; }
public void updateLocale() { lblInstallFolder.setText(I18N.getLocaleString("INSTALL_FOLDER")); tglbtnForceUpdate.setText(I18N.getLocaleString("FORCE_UPDATE")); ; lblRamMaximum.setText(I18N.getLocaleString("RAM_MAX")); lblLocale.setText(I18N.getLocaleString("LANGUAGE")); }
public CategoryToolbar() { // Init components elementGroup = new javax.swing.ButtonGroup(); for (final String elmtType : AppearanceUIController.ELEMENT_CLASSES) { JToggleButton btn = new JToggleButton(); btn.setFocusPainted(false); String btnLabel = elmtType; try { btnLabel = NbBundle.getMessage( AppearanceToolbar.class, "AppearanceToolbar." + elmtType + ".label"); } catch (MissingResourceException e) { } btn.setText(btnLabel); btn.setEnabled(false); btn.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { controller.setSelectedElementClass(elmtType); } }); elementGroup.add(btn); add(btn); } box = new javax.swing.JLabel(); addSeparator(); box.setMaximumSize(new java.awt.Dimension(32767, 32767)); add(box); }
protected void AddAndword(String Letter, String Andwoord, Color Kleur) { javax.swing.JLabel lbl; javax.swing.JPanel pnl; javax.swing.JToggleButton tcmd; pnl = new javax.swing.JPanel(); tcmd = new javax.swing.JToggleButton(); lbl = new javax.swing.JLabel(); pnl.setBackground(Kleur); pnl.setBorder(javax.swing.BorderFactory.createEtchedBorder()); tcmd.setFont(new java.awt.Font("DejaVu Sans", 1, 36)); lbl.setFont(new java.awt.Font("DejaVu Sans", 1, 12)); tcmd.setText(Letter); tcmd.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED)); tcmd.setMaximumSize(new java.awt.Dimension(30, 30)); tcmd.setMinimumSize(new java.awt.Dimension(30, 30)); tcmd.setPreferredSize(new java.awt.Dimension(30, 30)); lbl.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); lbl.setVerticalAlignment(javax.swing.SwingConstants.TOP); lbl.setText(Andwoord); lbl.setBorder(null); javax.swing.GroupLayout pnlALayout = new javax.swing.GroupLayout(pnl); pnl.setLayout(pnlALayout); pnlALayout.setHorizontalGroup( pnlALayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( pnlALayout .createSequentialGroup() .addComponent( tcmd, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( lbl, javax.swing.GroupLayout.DEFAULT_SIZE, 354, Short.MAX_VALUE))); pnlALayout.setVerticalGroup( pnlALayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( pnlALayout .createSequentialGroup() .addComponent( tcmd, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(32, Short.MAX_VALUE)) .addComponent(lbl, javax.swing.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE)); Antwoorde.add(pnl); }
/** * Constructs the button with the given node type and image prefix. If the node type is "Select", * constructs a button that allows nodes to be selected and moved. If the node type is "Edge", * constructs a button that allows edges to be drawn. For other node types, constructs buttons * that allow those type of nodes to be added to the workbench. If a non-null image prefix is * provided, images for <prefix>Up.gif, <prefix>Down.gif, <prefix>Off.gif and <prefix>Roll.gif are * loaded from the /images directory relative to this compiled class and used to provide up, down, * off, and rollover images for the constructed button. On construction, nodes are mapped to their * node types in the Map, <code>nodeTypes</code>. Listeners are added to the node. * * @param buttonInfo contains the info needed to construct the button. */ private JToggleButton constructButton(ButtonInfo buttonInfo) { String imagePrefix = buttonInfo.getImagePrefix(); if (imagePrefix == null) { throw new NullPointerException("Image prefix must not be null."); } JToggleButton button = new JToggleButton(); button.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { super.mouseClicked(e); setShiftDown(e.isShiftDown()); // setControlDown(e.isControlDown()); } }); if ("Select".equals(buttonInfo.getNodeTypeName())) { button.setIcon(new ImageIcon(ImageUtils.getImage(this, "move.gif"))); } else if ("Edge".equals(buttonInfo.getNodeTypeName())) { button.setIcon(new ImageIcon(ImageUtils.getImage(this, "flow.gif"))); } else { button.setName(buttonInfo.getNodeTypeName()); button.setText("<html><center>" + buttonInfo.getDisplayName() + "</center></html>"); } button.setMaximumSize(new Dimension(110, 40)); // For a vertical box. button.setToolTipText(buttonInfo.getToolTipText()); this.nodeTypes.put(button, buttonInfo.getNodeTypeName()); return button; }
private JToggleButton getJToggleButton3() { if (jToggleButton3 == null) { jToggleButton3 = new JToggleButton(); jToggleButton3.setText("負け"); } return jToggleButton3; }
private JToggleButton getJToggleButton4() { if (jToggleButton4 == null) { jToggleButton4 = new JToggleButton(); jToggleButton4.setText("あいこ"); } return jToggleButton4; }
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); }
private void handleRegister() { if (session == null || !session.isConnected()) { jToggleButtonRegister.setSelected(false); jMenuItemOptionsDeregister.setEnabled(false); jMenuItemOptionsRegister.setEnabled(true); return; } if (jToggleButtonRegister.isSelected() || jMenuItemOptionsRegister.isEnabled()) { register(); jToggleButtonRegister.setText("Deregister"); jMenuItemOptionsDeregister.setEnabled(true); jMenuItemOptionsRegister.setEnabled(false); } else { deregister(); jToggleButtonRegister.setText("Register"); jMenuItemOptionsDeregister.setEnabled(false); jMenuItemOptionsRegister.setEnabled(true); } }
public ErrorTable(final MainFrame mainFrame) { super(new BorderLayout()); this.mainFrame = mainFrame; onlyCurrent.setSelected(false); table.setShowVerticalLines(false); table.setModel(model); table.installToolTip(); table.getColumnModel().getColumn(0).setPreferredWidth(400); table.getColumnModel().getColumn(1).setPreferredWidth(200); table.getColumnModel().getColumn(2).setPreferredWidth(150); headerLabel.setHorizontalAlignment(SwingConstants.CENTER); headerLabel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); table.setBorder(null); JScrollPane scrollPane = new ExtendedJScrollPane(table); scrollPane.setBorder(null); add(scrollPane, BorderLayout.CENTER); ViewToolBar toolBar = new ViewToolBar(); toolBar.add(onlyCurrent); onlyCurrent.setText(null); toolBar.add(headerLabel); add(toolBar, BorderLayout.NORTH); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { switch (table.getSelectedColumn()) { // quick fixes case 1: List<? extends QuickFix> quickFixes = errors.get(table.getSelectedRow()).getQuickFixes(); if (quickFixes.size() == 1) { quickFixes.get(0).apply(); } if (quickFixes.size() > 1) { new QuickFixDialog(quickFixes).setVisible(true); } break; default: ProcessSetupError error = errors.get(table.getSelectedRow()); Operator op = error.getOwner().getOperator(); ErrorTable.this.mainFrame.selectOperator(op); // other } } } }); }
private JToggleButton getJToggleButton1() { if (jToggleButton1 == null) { jToggleButton1 = new JToggleButton(); jToggleButton1.setText("じゃんけんぽん"); jToggleButton1.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent event) { jToggleButton1MouseMouseClicked(event); } }); } return jToggleButton1; }
private JToggleButton getJToggleButton0() { if (jToggleButton0 == null) { jToggleButton0 = new JToggleButton(); jToggleButton0.setText("登録"); jToggleButton0.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent event) { jToggleButton0MouseMouseClicked(event); } }); } return jToggleButton0; }
private void handleConnect() { if (jToggleButtonConnect.isSelected() || jMenuItemServerConnect.isEnabled()) try { jTextPaneDisplayMessages.setText(""); session = new Session(); try { String userid = jTextFieldUser.getText(); if (jPasswordFieldPwd.getPassword() != null) { String pwd = String.valueOf(jPasswordFieldPwd.getPassword()).trim(); if (!pwd.equals("")) { userid += ":" + pwd; } } if (session.connect(jTextFieldServer.getText(), userid)) { displayMessage("Connected\n", incomingMsgAttrSet); session.addListener(this); jToggleButtonConnect.setText("Disconnect"); jMenuItemServerConnect.setEnabled(false); jMenuItemServerDisconnect.setEnabled(true); } else { jToggleButtonConnect.setSelected(false); jMenuItemServerConnect.setEnabled(true); jMenuItemServerDisconnect.setEnabled(false); displayMessage("Connection attempt failed\n", offlineClientAttrSet); } } catch (ConnectionException ex1) { jToggleButtonConnect.setSelected(false); jMenuItemServerConnect.setEnabled(true); jMenuItemServerDisconnect.setEnabled(false); displayMessage( "Connection attempt failed: " + ex1.getMessage() + "\n", offlineClientAttrSet); } } catch (Exception ex) { ex.printStackTrace(); } else { disconnect(); jMenuItemServerConnect.setEnabled(true); jMenuItemServerDisconnect.setEnabled(false); displayMessage("Disconnected\n", offlineClientAttrSet); } }
public JModRadioButton( int x, int y, int w, int h, Object obj, int min_val, int max_val, Parameter newPar) { super(min_val, max_val, newPar); b = new JToggleButton(); if (obj instanceof String) { b.setText((String) obj); b.setFont(new Font("Dialog", Font.PLAIN, 10)); } // ImageIcon icon = new ImageIcon("./grafix/_sync.gif"); // b = new JToggleButton(new ImageIcon("./grafix/_sync.gif")); b.setSize(w, h); b.setMargin(new Insets(0, 0, 0, 0)); b.setFocusPainted(false); add(b); setLocation(x, y); setSize(b.getWidth(), b.getHeight()); b.setSelected(par.getValue() == getMaxValue()); b.addMouseListener( new MouseAdapter() { public void mouseReleased(MouseEvent arg0) { if (b.isSelected()) setValue(getMaxValue()); else b.setSelected(true); } }); par.addChangeListener( new ChangeListener() { public void stateChanged(ChangeEvent e) { int val = (int) ((Parameter) e.getSource()).getValue(); setValueWithoutFireStarter(val); } }); }
protected void setup() { clear(); if (model != null) { for (String elmtType : AppearanceUIController.ELEMENT_CLASSES) { for (TransformerCategory c : controller.getCategories(elmtType)) { ButtonGroup buttonGroup = new ButtonGroup(); Map<String, TransformerUI> titles = new LinkedHashMap<String, TransformerUI>(); for (TransformerUI t : controller.getTransformerUIs(elmtType, c)) { titles.put(t.getDisplayName(), t); } for (Map.Entry<String, TransformerUI> entry : titles.entrySet()) { // Build button final TransformerUI value = entry.getValue(); Icon icon = entry.getValue().getIcon(); // DecoratedIcon decoratedIcon = getDecoratedIcon(icon, t); // JToggleButton btn = new JToggleButton(decoratedIcon); JToggleButton btn = new JToggleButton(icon); btn.setToolTipText(entry.getValue().getDescription()); btn.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { controller.setSelectedTransformerUI(value); } }); btn.setName(entry.getKey()); btn.setText(entry.getKey()); btn.setFocusPainted(false); buttonGroup.add(btn); add(btn); } buttonGroups.add(buttonGroup); } } } }
private void initEditor() { ApplicationContext c = Application.getInstance(RoutingDemo.class).getContext(); ActionMap appActionMap = c.getActionMap(RoutingDemo.getApplication()); ActionMap editorActionMap = c.getActionMap(EditorController.getInstance()); ActionMap simulationActionMap = c.getActionMap(SimulationController.getInstance()); ResourceMap fileRm = c.getResourceMap(DocumentController.class); ActionMap fileActionMap = c.getActionMap(DocumentController.getInstance()); btnNew = new JButton(); btnNew.setAction(fileActionMap.get("newFileAction")); add(btnNew); btnLoad = new JButton(); btnLoad.setAction(fileActionMap.get("loadFileAction")); add(btnLoad); btnReload = new JButton(); btnReload.setAction(fileActionMap.get("reloadFileAction")); add(btnReload); btnSave = new JButton(); btnSave.setAction(fileActionMap.get("saveFileAction")); add(btnSave); btnSaveAs = new JButton(); btnSaveAs.setAction(fileActionMap.get("saveFileAsAction")); add(btnSaveAs); btnClose = new JButton(); btnClose.setAction(fileActionMap.get("closeFileAction")); add(btnClose); btnExit = new JButton(); btnExit.setAction(appActionMap.get("quit")); btnExit.setText(""); btnExit.setIcon(fileRm.getImageIcon("quitAction.Action.icon")); add(btnExit); addSeparator(); btngGroup = new ButtonGroup(); btnSelection = new JToggleButton(); btnSelection.setAction(editorActionMap.get("setSelectionEditorStateAction")); btnSelection.setText(""); btnSelection.setIcon(fileRm.getImageIcon("selectionAction.Action.icon")); btnSelection.setSelected(true); btngGroup.add(btnSelection); add(btnSelection); btnAddNode = new JToggleButton(); btnAddNode.setAction(editorActionMap.get("setAddNodeEditorStateAction")); btnAddNode.setText(""); btnAddNode.setIcon(fileRm.getImageIcon("addPointAction.Action.icon")); btngGroup.add(btnAddNode); add(btnAddNode); btnAddEdge = new JToggleButton(); btnAddEdge.setAction(editorActionMap.get("setAddEdgeEditorStateAction")); btnAddEdge.setText(""); btngGroup.add(btnAddEdge); btnAddEdge.setIcon(fileRm.getImageIcon("addEdgeAction.Action.icon")); add(btnAddEdge); btnSetProperties = new JToggleButton(); btnSetProperties.setAction(editorActionMap.get("setSetPropertiesEditorStateAction")); btnSetProperties.setText(""); btngGroup.add(btnSetProperties); btnSetProperties.setIcon(fileRm.getImageIcon("setPropertiesAction.Action.icon")); add(btnSetProperties); btnSimulate = new JButton(); btnSimulate.setAction(simulationActionMap.get("showSimulationDialogAction")); btnSimulate.setText(""); btngGroup.add(btnSimulate); btnSimulate.setIcon(fileRm.getImageIcon("simulateAction.Action.icon")); add(btnSimulate); }
protected void displayZoom(double zoom) { usezoombt.setText(String.format(Locale.US, "%.2f", zoom)); if (usezoombt.isSelected()) getParticlePicker().setZoom(zoom); pack(); }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; buttonGroup1 = new javax.swing.ButtonGroup(); jPanel1 = new javax.swing.JPanel(); panPeriod = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); dpiFrom = new org.jdesktop.swingx.JXDatePicker(); dpiTo = new org.jdesktop.swingx.JXDatePicker(); jPanel2 = new javax.swing.JPanel(); btnThisWeek = new javax.swing.JToggleButton(); btnLastWeek = new javax.swing.JToggleButton(); btnThisMonth = new javax.swing.JToggleButton(); btnLastMonth = new javax.swing.JToggleButton(); jPanel7 = new javax.swing.JPanel(); btnRefreshAnlaesse = new javax.swing.JButton(); panMasterDetail = new javax.swing.JPanel(); panMaster = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jXTable1 = new org.jdesktop.swingx.JXTable(); panDetail = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); lblDokumentLink = new javax.swing.JLabel(); jPanel5 = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); jScrollPane2 = new javax.swing.JScrollPane(); lstKassenzeichen = new javax.swing.JList(); jButton1 = new javax.swing.JButton(); cbxAbgearbeitet = new javax.swing.JCheckBox(); jPanel6 = new javax.swing.JPanel(); jPanel8 = new javax.swing.JPanel(); btnCloseDialog = new javax.swing.JButton(); jProgressBar1 = new javax.swing.JProgressBar(); jPanel9 = new javax.swing.JPanel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.title")); // NOI18N getContentPane().setLayout(new java.awt.GridBagLayout()); jPanel1.setPreferredSize(new java.awt.Dimension(800, 643)); jPanel1.setLayout(new java.awt.GridBagLayout()); panPeriod.setBorder( javax.swing.BorderFactory.createTitledBorder( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.panPeriod.border.title"))); // NOI18N panPeriod.setLayout(new java.awt.GridBagLayout()); jLabel1.setText( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.jLabel1.text")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(10, 10, 5, 5); panPeriod.add(jLabel1, gridBagConstraints); jLabel2.setText( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.jLabel2.text")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; gridBagConstraints.insets = new java.awt.Insets(10, 10, 5, 5); panPeriod.add(jLabel2, gridBagConstraints); dpiFrom.addPropertyChangeListener( new java.beans.PropertyChangeListener() { @Override public void propertyChange(final java.beans.PropertyChangeEvent evt) { dpiFromPropertyChange(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(10, 0, 5, 10); panPeriod.add(dpiFrom, gridBagConstraints); dpiTo.addPropertyChangeListener( new java.beans.PropertyChangeListener() { @Override public void propertyChange(final java.beans.PropertyChangeEvent evt) { dpiToPropertyChange(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 5; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(10, 0, 5, 10); panPeriod.add(dpiTo, gridBagConstraints); jPanel2.setLayout(new java.awt.GridLayout(2, 3, 5, 5)); buttonGroup1.add(btnThisWeek); btnThisWeek.setText( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.btnThisWeek.text")); // NOI18N btnThisWeek.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { btnThisWeekActionPerformed(evt); } }); jPanel2.add(btnThisWeek); buttonGroup1.add(btnLastWeek); btnLastWeek.setText( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.btnLastWeek.text")); // NOI18N btnLastWeek.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { btnLastWeekActionPerformed(evt); } }); jPanel2.add(btnLastWeek); buttonGroup1.add(btnThisMonth); btnThisMonth.setText( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.btnThisMonth.text")); // NOI18N btnThisMonth.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { btnThisMonthActionPerformed(evt); } }); jPanel2.add(btnThisMonth); buttonGroup1.add(btnLastMonth); btnLastMonth.setText( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.btnLastMonth.text")); // NOI18N btnLastMonth.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { btnLastMonthActionPerformed(evt); } }); jPanel2.add(btnLastMonth); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridheight = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; gridBagConstraints.insets = new java.awt.Insets(10, 10, 10, 10); panPeriod.add(jPanel2, gridBagConstraints); jPanel7.setPreferredSize(new java.awt.Dimension(50, 10)); final javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7); jPanel7.setLayout(jPanel7Layout); jPanel7Layout.setHorizontalGroup( jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 50, Short.MAX_VALUE)); jPanel7Layout.setVerticalGroup( jPanel7Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 88, Short.MAX_VALUE)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.gridheight = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; gridBagConstraints.weightx = 1.0; panPeriod.add(jPanel7, gridBagConstraints); btnRefreshAnlaesse.setText( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.btnRefreshAnlaesse.text")); // NOI18N btnRefreshAnlaesse.setEnabled(false); btnRefreshAnlaesse.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { btnRefreshAnlaesseActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 4; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 10, 10, 10); panPeriod.add(btnRefreshAnlaesse, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jPanel1.add(panPeriod, gridBagConstraints); panMasterDetail.setLayout(new java.awt.GridBagLayout()); panMaster.setBorder( javax.swing.BorderFactory.createTitledBorder( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.panMaster.border.title"))); // NOI18N panMaster.setLayout(new java.awt.GridBagLayout()); jXTable1.setEnabled(false); jScrollPane1.setViewportView(jXTable1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 10, 10, 10); panMaster.add(jScrollPane1, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 10); panMasterDetail.add(panMaster, gridBagConstraints); panMaster .getAccessibleContext() .setAccessibleName( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.panMaster.AccessibleContext.accessibleName")); // NOI18N panDetail.setBorder(null); panDetail.setMinimumSize(new java.awt.Dimension(250, 137)); panDetail.setPreferredSize(new java.awt.Dimension(250, 244)); panDetail.setVerifyInputWhenFocusTarget(false); panDetail.setLayout(new java.awt.GridBagLayout()); jPanel3.setBorder( javax.swing.BorderFactory.createTitledBorder( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.jPanel3.border.title"))); // NOI18N jPanel3.setLayout(new java.awt.GridBagLayout()); lblDokumentLink.setText( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.lblDokumentLink.text")); // NOI18N lblDokumentLink.setEnabled(false); lblDokumentLink.addMouseListener( new java.awt.event.MouseAdapter() { @Override public void mouseClicked(final java.awt.event.MouseEvent evt) { lblDokumentLinkMouseClicked(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(10, 10, 10, 10); jPanel3.add(lblDokumentLink, gridBagConstraints); final javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE)); jPanel5Layout.setVerticalGroup( jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; jPanel3.add(jPanel5, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 0); panDetail.add(jPanel3, gridBagConstraints); jPanel4.setBorder( javax.swing.BorderFactory.createTitledBorder( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.jPanel4.border.title"))); // NOI18N jPanel4.setLayout(new java.awt.GridBagLayout()); lstKassenzeichen.setModel(new DefaultListModel()); lstKassenzeichen.setEnabled(false); lstKassenzeichen.addMouseListener( new java.awt.event.MouseAdapter() { @Override public void mouseClicked(final java.awt.event.MouseEvent evt) { lstKassenzeichenMouseClicked(evt); } }); lstKassenzeichen.addListSelectionListener( new javax.swing.event.ListSelectionListener() { @Override public void valueChanged(final javax.swing.event.ListSelectionEvent evt) { lstKassenzeichenValueChanged(evt); } }); jScrollPane2.setViewportView(lstKassenzeichen); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(10, 10, 10, 10); jPanel4.add(jScrollPane2, gridBagConstraints); jButton1.setText( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.jButton1.text")); // NOI18N jButton1.setEnabled(false); jButton1.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(0, 10, 10, 10); jPanel4.add(jButton1, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 0); panDetail.add(jPanel4, gridBagConstraints); cbxAbgearbeitet.setText( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.cbxAbgearbeitet.text")); // NOI18N cbxAbgearbeitet.setEnabled(false); cbxAbgearbeitet.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { cbxAbgearbeitetActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0); panDetail.add(cbxAbgearbeitet, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 10, 0, 0); panMasterDetail.add(panDetail, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jPanel1.add(panMasterDetail, gridBagConstraints); final javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup( jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE)); jPanel6Layout.setVerticalGroup( jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; jPanel1.add(jPanel6, gridBagConstraints); jPanel8.setLayout(new java.awt.GridBagLayout()); btnCloseDialog.setText( org.openide.util.NbBundle.getMessage( FortfuehrungsanlaesseDialog.class, "FortfuehrungsanlaesseDialog.btnCloseDialog.text")); // NOI18N btnCloseDialog.addActionListener( new java.awt.event.ActionListener() { @Override public void actionPerformed(final java.awt.event.ActionEvent evt) { btnCloseDialogActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.LAST_LINE_END; gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0); jPanel8.add(btnCloseDialog, gridBagConstraints); jProgressBar1.setIndeterminate(true); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5); jPanel8.add(jProgressBar1, gridBagConstraints); jPanel9.setOpaque(false); final javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9); jPanel9.setLayout(jPanel9Layout); jPanel9Layout.setHorizontalGroup( jPanel9Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 634, Short.MAX_VALUE)); jPanel9Layout.setVerticalGroup( jPanel9Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 30, Short.MAX_VALUE)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; jPanel8.add(jPanel9, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jPanel1.add(jPanel8, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); getContentPane().add(jPanel1, gridBagConstraints); pack(); } // </editor-fold>
private void SetupUI(String loginID) { chatFrame = new JFrame("Chat " + loginID); PrivateMessageDialog = new JDialog(chatFrame, true); PvtMsgPanel = new javax.swing.JPanel(); SendPrivate = new javax.swing.JButton(); PrivateInput = new javax.swing.JTextArea(); PvtUserId = new javax.swing.JTextField(); RecipientLabel = new javax.swing.JLabel(); MessageLabel = new javax.swing.JLabel(); MainWindowTabs = new javax.swing.JTabbedPane(); ChatWindow = new javax.swing.JPanel(); ChatDisplayScroll = new javax.swing.JScrollPane(); MessageDisplay = new javax.swing.JTextArea(); MessageScroll = new javax.swing.JScrollPane(); MessageInput = new javax.swing.JTextArea(); Send = new javax.swing.JButton(); PrivateMsg = new javax.swing.JButton(); DrawPadButton = new javax.swing.JButton(); Availability = new javax.swing.JToggleButton(); SettingsWindow = new javax.swing.JPanel(); settingsChatPanel = new javax.swing.JPanel(); SetChannelButton = new javax.swing.JButton(); ChannelToSetTo = new javax.swing.JTextField(); ForwardTo = new javax.swing.JTextField(); ForwardButton = new javax.swing.JButton(); blockPanel = new javax.swing.JPanel(); WhoIBlockButton = new javax.swing.JButton(); BlockButton = new javax.swing.JButton(); WhoBlocksMeButton = new javax.swing.JButton(); UnblockButton = new javax.swing.JButton(); UserToChangeBlock = new javax.swing.JTextField(); networkPanel = new javax.swing.JPanel(); PortInput = new javax.swing.JTextField(); SetPortButton = new javax.swing.JButton(); HostInput = new javax.swing.JTextField(); SetHostButton = new javax.swing.JButton(); GetHost = new javax.swing.JButton(); GetPort = new javax.swing.JButton(); // Customize Form Send.setBackground(Color.decode("#16A085")); SendPrivate.setBackground(Color.decode("#16A085")); Availability.setBackground(Color.decode("#2ECC71")); MessageDisplay.setEditable(false); PrivateMessageDialog.setSize(405, 335); chatFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); chatFrame.setBackground(new java.awt.Color(52, 73, 94)); MainWindowTabs.setBackground(new java.awt.Color(44, 62, 80)); MainWindowTabs.setOpaque(true); // Netbeans PvtMsgPanel.setBackground(new java.awt.Color(52, 73, 94)); SendPrivate.setText("Send"); PrivateInput.setBackground(new java.awt.Color(127, 140, 141)); PrivateInput.setColumns(20); PrivateInput.setFont(new java.awt.Font("Arial", 0, 13)); PrivateInput.setLineWrap(true); PrivateInput.setRows(5); PvtUserId.setBackground(new java.awt.Color(127, 140, 141)); RecipientLabel.setForeground(new java.awt.Color(240, 240, 240)); RecipientLabel.setText("Recipient Id:"); MessageLabel.setForeground(new java.awt.Color(240, 240, 240)); MessageLabel.setText("Message:"); javax.swing.GroupLayout PvtMsgPanelLayout = new javax.swing.GroupLayout(PvtMsgPanel); PvtMsgPanel.setLayout(PvtMsgPanelLayout); PvtMsgPanelLayout.setHorizontalGroup( PvtMsgPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( PvtMsgPanelLayout.createSequentialGroup() .addContainerGap() .addGroup( PvtMsgPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(PvtUserId) .addGroup( PvtMsgPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING) .addComponent( SendPrivate, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup( PvtMsgPanelLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent( PrivateInput, javax.swing.GroupLayout.Alignment.LEADING) .addGroup( PvtMsgPanelLayout.createSequentialGroup() .addComponent(RecipientLabel) .addGap(310, 310, 310)))) .addComponent(MessageLabel)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); PvtMsgPanelLayout.setVerticalGroup( PvtMsgPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( PvtMsgPanelLayout.createSequentialGroup() .addContainerGap() .addComponent(RecipientLabel) .addGap(1, 1, 1) .addComponent( PvtUserId, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(MessageLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( PrivateInput, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( SendPrivate, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); javax.swing.GroupLayout PrivateMessageDialogLayout = new javax.swing.GroupLayout(PrivateMessageDialog.getContentPane()); PrivateMessageDialog.getContentPane().setLayout(PrivateMessageDialogLayout); PrivateMessageDialogLayout.setHorizontalGroup( PrivateMessageDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( PvtMsgPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); PrivateMessageDialogLayout.setVerticalGroup( PrivateMessageDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( PrivateMessageDialogLayout.createSequentialGroup() .addComponent( PvtMsgPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 3, Short.MAX_VALUE))); MainWindowTabs.setBackground(new java.awt.Color(52, 73, 94)); ChatWindow.setBackground(new java.awt.Color(52, 73, 94)); ChatWindow.setPreferredSize(new java.awt.Dimension(430, 600)); ChatWindow.setVerifyInputWhenFocusTarget(false); ChatDisplayScroll.setAutoscrolls(true); MessageDisplay.setEditable(false); MessageDisplay.setBackground(new java.awt.Color(127, 140, 141)); MessageDisplay.setColumns(20); MessageDisplay.setFont(new java.awt.Font("Arial", 0, 13)); MessageDisplay.setLineWrap(true); MessageDisplay.setRows(5); ChatDisplayScroll.setViewportView(MessageDisplay); MessageInput.setBackground(new java.awt.Color(127, 140, 141)); MessageInput.setColumns(2); MessageInput.setLineWrap(true); MessageInput.setRows(3); MessageScroll.setViewportView(MessageInput); Send.setText("Send"); PrivateMsg.setText("Private Message"); DrawPadButton.setText("Draw Pad"); Availability.setText("Available"); javax.swing.GroupLayout ChatWindowLayout = new javax.swing.GroupLayout(ChatWindow); ChatWindow.setLayout(ChatWindowLayout); ChatWindowLayout.setHorizontalGroup( ChatWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( ChatWindowLayout.createSequentialGroup() .addContainerGap() .addGroup( ChatWindowLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( ChatDisplayScroll, javax.swing.GroupLayout.Alignment.TRAILING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, ChatWindowLayout.createSequentialGroup() .addComponent(MessageScroll) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( Send, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, ChatWindowLayout.createSequentialGroup() .addComponent( DrawPadButton, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( PrivateMsg, javax.swing.GroupLayout.DEFAULT_SIZE, 146, Short.MAX_VALUE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent( Availability, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap())); ChatWindowLayout.setVerticalGroup( ChatWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( ChatWindowLayout.createSequentialGroup() .addGap(7, 7, 7) .addComponent( ChatDisplayScroll, javax.swing.GroupLayout.PREFERRED_SIZE, 289, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( ChatWindowLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( MessageScroll, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( Send, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( ChatWindowLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(DrawPadButton) .addComponent(PrivateMsg) .addComponent(Availability)) .addContainerGap())); MainWindowTabs.addTab("Chat", ChatWindow); SettingsWindow.setBackground(new java.awt.Color(52, 73, 94)); settingsChatPanel.setBackground(new java.awt.Color(52, 73, 94)); settingsChatPanel.setBorder( javax.swing.BorderFactory.createTitledBorder( new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED), "Chat", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(240, 240, 240))); SetChannelButton.setText("Set Channel"); SetChannelButton.setBorderPainted(false); ChannelToSetTo.setBackground(new java.awt.Color(127, 140, 141)); ForwardTo.setBackground(new java.awt.Color(127, 140, 141)); ForwardButton.setText("Forward"); ForwardButton.setBorderPainted(false); javax.swing.GroupLayout settingsChatPanelLayout = new javax.swing.GroupLayout(settingsChatPanel); settingsChatPanel.setLayout(settingsChatPanelLayout); settingsChatPanelLayout.setHorizontalGroup( settingsChatPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( settingsChatPanelLayout .createSequentialGroup() .addContainerGap(80, Short.MAX_VALUE) .addGroup( settingsChatPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addGroup( javax.swing.GroupLayout.Alignment.LEADING, settingsChatPanelLayout .createSequentialGroup() .addComponent( ChannelToSetTo, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(SetChannelButton)) .addGroup( javax.swing.GroupLayout.Alignment.LEADING, settingsChatPanelLayout .createSequentialGroup() .addComponent( ForwardTo, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( ForwardButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap(68, Short.MAX_VALUE))); settingsChatPanelLayout.setVerticalGroup( settingsChatPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( settingsChatPanelLayout .createSequentialGroup() .addContainerGap() .addGroup( settingsChatPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( ChannelToSetTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(SetChannelButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( settingsChatPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ForwardButton) .addComponent( ForwardTo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); blockPanel.setBackground(new java.awt.Color(52, 73, 94)); blockPanel.setBorder( javax.swing.BorderFactory.createTitledBorder( new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED), "Block", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(240, 240, 240))); blockPanel.setForeground(new java.awt.Color(255, 255, 255)); WhoIBlockButton.setText("My Blocks"); BlockButton.setBorderPainted(false); BlockButton.setText("Block"); WhoBlocksMeButton.setText("Blocks Me"); UnblockButton.setText("Unblock"); UnblockButton.setActionCommand("Unblock"); UnblockButton.setBorderPainted(false); UserToChangeBlock.setBackground(new java.awt.Color(127, 140, 141)); javax.swing.GroupLayout blockPanelLayout = new javax.swing.GroupLayout(blockPanel); blockPanel.setLayout(blockPanelLayout); blockPanelLayout.setHorizontalGroup( blockPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, blockPanelLayout .createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( UserToChangeBlock, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( blockPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( blockPanelLayout .createSequentialGroup() .addComponent( BlockButton, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(WhoIBlockButton)) .addGroup( blockPanelLayout .createSequentialGroup() .addComponent( UnblockButton, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(WhoBlocksMeButton))) .addGap(23, 23, 23))); blockPanelLayout.setVerticalGroup( blockPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( blockPanelLayout .createSequentialGroup() .addContainerGap() .addGroup( blockPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( blockPanelLayout .createSequentialGroup() .addGroup( blockPanelLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(BlockButton) .addComponent(WhoIBlockButton)) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( blockPanelLayout .createParallelGroup( javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(UnblockButton) .addComponent(WhoBlocksMeButton))) .addGroup( blockPanelLayout .createSequentialGroup() .addGap(13, 13, 13) .addComponent( UserToChangeBlock, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); networkPanel.setBackground(new java.awt.Color(52, 73, 94)); networkPanel.setBorder( javax.swing.BorderFactory.createTitledBorder( new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED), "Network", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, new java.awt.Color(240, 240, 240))); PortInput.setBackground(new java.awt.Color(127, 140, 141)); SetPortButton.setText("Set Port"); HostInput.setBackground(new java.awt.Color(127, 140, 141)); SetHostButton.setText("Set Host"); GetHost.setText("Get Host"); GetPort.setText("Get Port"); javax.swing.GroupLayout networkPanelLayout = new javax.swing.GroupLayout(networkPanel); networkPanel.setLayout(networkPanelLayout); networkPanelLayout.setHorizontalGroup( networkPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, networkPanelLayout .createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup( networkPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(PortInput) .addComponent( HostInput, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup( networkPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup( networkPanelLayout .createSequentialGroup() .addGap(6, 6, 6) .addComponent( SetHostButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup( networkPanelLayout .createSequentialGroup() .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent( SetPortButton, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup( networkPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent( GetPort, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(GetHost)) .addGap(25, 25, 25))); networkPanelLayout.setVerticalGroup( networkPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( networkPanelLayout .createSequentialGroup() .addContainerGap() .addGroup( networkPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( PortInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(SetPortButton) .addComponent(GetPort)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup( networkPanelLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent( HostInput, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(SetHostButton) .addComponent(GetHost)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); javax.swing.GroupLayout SettingsWindowLayout = new javax.swing.GroupLayout(SettingsWindow); SettingsWindow.setLayout(SettingsWindowLayout); SettingsWindowLayout.setHorizontalGroup( SettingsWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( SettingsWindowLayout.createSequentialGroup() .addContainerGap() .addGroup( SettingsWindowLayout.createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent( networkPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( settingsChatPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( blockPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap())); SettingsWindowLayout.setVerticalGroup( SettingsWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( SettingsWindowLayout.createSequentialGroup() .addGap(20, 20, 20) .addComponent( networkPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(33, 33, 33) .addComponent( blockPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(31, 31, 31) .addComponent( settingsChatPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(34, Short.MAX_VALUE))); MainWindowTabs.addTab("Settings", SettingsWindow); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(chatFrame.getContentPane()); chatFrame.getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addComponent( MainWindowTabs, javax.swing.GroupLayout.PREFERRED_SIZE, 413, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( MainWindowTabs, javax.swing.GroupLayout.PREFERRED_SIZE, 439, javax.swing.GroupLayout.PREFERRED_SIZE)); // ##################### Listeners ##################### // display scrollbar vertical update ChatDisplayScroll.getVerticalScrollBar() .addAdjustmentListener( new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent event) { event.getAdjustable().setValue(event.getAdjustable().getMaximum()); } }); MessageInput.addKeyListener( new KeyListener() { @Override public void keyPressed(KeyEvent arg0) { int keyCode = arg0.getKeyCode(); if (keyCode == 10) { // enter key String message = MessageInput.getText(); if (message != null && message.length() > 0) { client.handleMessageFromClientUI(message); MessageInput.setText(""); arg0.consume(); } } } @Override public void keyTyped(KeyEvent arg0) {} @Override public void keyReleased(KeyEvent arg0) {} }); SetChannelButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String command = SetChannelButton.getActionCommand(); if (command == "Set Channel") { // get new channel String channel = ChannelToSetTo.getText(); if (channel.length() > 0) { client.handleMessageFromClientUI("#setchannel " + channel); ChannelToSetTo.setText(""); MainWindowTabs.setSelectedIndex(0); } } } }); SetPortButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String command = SetPortButton.getActionCommand(); if (command == "Set Port") { // get new port String port = PortInput.getText(); if (port.length() > 0) { client.connectionClosed(); client.handleMessageFromClientUI("#setport " + port); MainWindowTabs.setSelectedIndex(0); PortInput.setText(""); } } } }); GetPort.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String command = GetPort.getActionCommand(); if (command == "Get Port") { client.handleMessageFromClientUI("#getport"); MainWindowTabs.setSelectedIndex(0); } } }); SetHostButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String command = SetHostButton.getActionCommand(); if (command == "Set Host") { // get new host String host = HostInput.getText(); if (host.length() > 0) { client.connectionClosed(); client.handleMessageFromClientUI("#sethost " + host); MainWindowTabs.setSelectedIndex(0); HostInput.setText(""); } } } }); GetHost.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String command = GetHost.getActionCommand(); if (command == "Get Host") { client.handleMessageFromClientUI("#gethost"); MainWindowTabs.setSelectedIndex(0); } } }); WhoIBlockButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String command = WhoIBlockButton.getActionCommand(); if (command == "My Blocks") { client.handleMessageFromClientUI("#whoiblock"); MainWindowTabs.setSelectedIndex(0); } } }); WhoBlocksMeButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String command = WhoBlocksMeButton.getActionCommand(); if (command == "Blocks Me") { client.handleMessageFromClientUI("#whoblocksme"); MainWindowTabs.setSelectedIndex(0); } } }); BlockButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String command = BlockButton.getActionCommand(); if (command == "Block") { // get blockee String blockee = UserToChangeBlock.getText(); if (blockee.length() > 0) { client.handleMessageFromClientUI("#block " + blockee); UserToChangeBlock.setText(""); MainWindowTabs.setSelectedIndex(0); } } } }); UnblockButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String command = UnblockButton.getActionCommand(); if (command == "Unblock") { // get unblockee String unblockee = UserToChangeBlock.getText(); client.handleMessageFromClientUI("#unblock " + unblockee); UserToChangeBlock.setText(""); MainWindowTabs.setSelectedIndex(0); } } }); ForwardButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String command = ForwardButton.getActionCommand(); if (command == "Forward") { // get new monitor String monitor = ForwardTo.getText(); if (monitor.length() > 0) { client.handleMessageFromClientUI("#forward " + monitor); ForwardTo.setText(""); MainWindowTabs.setSelectedIndex(0); } } else if (command == "Stop Forwarding") { client.handleMessageFromClientUI("#endforward"); } } }); Availability.addItemListener( new ItemListener() { public void itemStateChanged(ItemEvent e) { if (Availability.isSelected()) { client.handleMessageFromClientUI("#notavailable"); Availability.setText("Unavailable"); Availability.setBackground(Color.decode("#E74C3C")); ForwardButton.setEnabled(false); MessageInput.setEnabled(false); DrawPadButton.setEnabled(false); PrivateMsg.setEnabled(false); Send.setEnabled(false); } else { client.handleMessageFromClientUI("#available"); Availability.setText("Available"); Availability.setBackground(Color.decode("#2ECC71")); ForwardButton.setEnabled(true); MessageInput.setEnabled(true); DrawPadButton.setEnabled(true); PrivateMsg.setEnabled(true); Send.setEnabled(true); } } }); Send.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String command = Send.getActionCommand(); if (command == "Send") { String message = MessageInput.getText(); if (message != null && message.length() > 0) { client.handleMessageFromClientUI(message); MessageInput.setText(""); } } } }); DrawPadButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String command = DrawPadButton.getActionCommand(); if (command == "Draw Pad") { drawPad = new ChatDrawPad(); new OpenDrawPad(drawPad, self); } } }); PrivateMsg.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String command = PrivateMsg.getActionCommand(); if (command == "Private Message") { PrivateMessageDialog.setVisible(true); } } }); SendPrivate.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String command = SendPrivate.getActionCommand(); if (command == "Send") { String recipId = PvtUserId.getText(); String msg = PrivateInput.getText(); if (recipId.length() > 0 && msg.length() > 0) client.handleMessageFromClientUI("#private " + recipId + " " + msg); PvtUserId.setText(""); PrivateInput.setText(""); PrivateMessageDialog.setVisible(false); } } }); // Display the window. chatFrame.pack(); chatFrame.setVisible(true); }
public void run() { while (true) { try { // System.out.println("Hello from a thread!"); if (coreWallet.isDirty()) { // Setup completed updateEncryptionState(); // System.out.println(coreWallet.getKeys()); java.util.List<ECKey> keys = coreWallet.getKeys(); // if (keys.size() != listAddresses.getModel().getSize()) { int selectedIndex = listAddresses.getSelectedIndex(); // DefaultListModel model = (DefaultListModel) listAddresses.getModel(); // model.removeAllElements(); // NetworkParameters params = MainNetParams.get(); List<String> addresses = new ArrayList<String>(); for (ECKey k : keys) { // System.out.println(k.toAddress(coreWallet.getNetworkParameters())); //params)); // model.addElement(k.toAddress(coreWallet.getNetworkParameters()).toString()); addresses.add(k.toAddress(coreWallet.getNetworkParameters()).toString()); } addressesListModel.setAddresses(addresses); if (selectedIndex != -1) { if (selectedIndex < addressesListModel.getSize()) listAddresses.setSelectedIndex(selectedIndex); else listAddresses.setSelectedIndex(0); } else if (addressesListModel.getSize() > 0) listAddresses.setSelectedIndex(0); refreshAddressAndQRCode(); if (coreWallet.getWallet().isEncrypted()) { tglbtnLock.setText("Encrypted"); tglbtnLock.setSelected(true); } else { tglbtnLock.setText("Not Encrypted"); tglbtnLock.setSelected(false); } // } String textBalance = bitcoinValueToFriendlyString(coreWallet.getBalance()); if (!textBalance.matches(textTotalBalance.getText())) { this.textTotalBalance.setText(textBalance); } this.frmWow.setTitle(coreWallet.getWalletFilePath() + " - Wow Doge Wallet"); // java.lang.Iterable<WalletTransaction> transactions = // coreWallet.getWalletTransactions(); List<Transaction> transactions = coreWallet.getTransactionsByTime(); System.out.println(transactions); // transactionsTableModel = new TransactionsTableModel(); // tableTransactions.setModel(transactionsTableModel); this.transactionsTableModel.setTransactions(transactions, coreWallet.getWallet()); tableTransactions.repaint(); coreWallet.setDirty(false); } if (coreWallet.isRunning()) { this.progressBarStatus.setVisible(false); this.lblStatus.setText(" Online "); this.progressBarStatus.setToolTipText("Synchronized"); } else if (coreWallet.isSynchronizing() != 0) { if (this.progressBarStatus.isIndeterminate()) { this.lblStatus.setText(" Synchronizing... "); this.progressBarStatus.setIndeterminate(false); this.progressBarStatus.setMaximum(coreWallet.isSynchronizing()); } int progress = this.progressBarStatus.getMaximum() - coreWallet.isSynchronizing(); int max = this.progressBarStatus.getMaximum(); this.progressBarStatus.setValue(progress); this.progressBarStatus.setToolTipText((((float) progress) / max * 100) + "%"); } else this.progressBarStatus.setIndeterminate(true); if (coreWallet.isStoreFileLocked()) { JOptionPane.showMessageDialog( frmWow, "Another Wow Doge Wallet instance is already running!\nPress OK button to quit.", "Information", JOptionPane.INFORMATION_MESSAGE); System.exit(1); } Thread.sleep(30); } catch (Exception e) { e.printStackTrace(); } } }
private void updateEncryptionState() { tglbtnLock.setText(coreWallet.isEncrypted() ? "Encrypted" : "Not Encrypted"); tglbtnLock.setToolTipText( coreWallet.isEncrypted() ? "Wallet is encrypted" : "Wallet is not encrypted"); tglbtnLock.setSelected(coreWallet.isEncrypted()); }
@Override public Component getComponent() { if (dockableComponent == null) { JScrollPane scrollPane = new ExtendedJScrollPane(this); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setBorder(null); dockableComponent = new JPanel(new BorderLayout()); JPanel toolBarPanel = new JPanel(new BorderLayout()); ViewToolBar toolBar = new ViewToolBar(); JToggleButton toggleExpertModeButton = mainFrame.TOGGLE_EXPERT_MODE_ACTION.createToggleButton(); toggleExpertModeButton.setText(null); toolBar.add(toggleExpertModeButton); Action infoOperatorAction = new InfoOperatorAction() { private static final long serialVersionUID = 6758272768665592429L; @Override protected Operator getOperator() { return mainFrame.getFirstSelectedOperator(); } }; toolBar.add(infoOperatorAction); JToggleButton enableOperatorButton = new ToggleActivationItem(mainFrame.getActions()).createToggleButton(); enableOperatorButton.setText(null); toolBar.add(enableOperatorButton); Action renameOperatorAction = new ResourceAction(true, "rename_in_processrenderer") { { setCondition(OPERATOR_SELECTED, MANDATORY); } private static final long serialVersionUID = -3104160320178045540L; @Override public void actionPerformed(ActionEvent e) { Operator operator = mainFrame.getFirstSelectedOperator(); String name = SwingTools.showInputDialog("rename_operator", operator.getName()); if (name != null && name.length() > 0) { operator.rename(name); } } }; toolBar.add(renameOperatorAction); toolBar.add(new DeleteOperatorAction()); breakpointButton.addToToolBar(toolBar); // toolBar.add(mainFrame.getActions().MAKE_DIRTY_ACTION); toolBarPanel.add(toolBar, BorderLayout.NORTH); JPanel headerPanel = new JPanel(); headerPanel.setBackground(SwingTools.LIGHTEST_BLUE); headerPanel.add(headerLabel); headerPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.LIGHT_GRAY)); toolBarPanel.add(headerPanel, BorderLayout.SOUTH); dockableComponent.add(toolBarPanel, BorderLayout.NORTH); dockableComponent.add(scrollPane, BorderLayout.CENTER); // compatibility level and warnings JPanel southPanel = new JPanel(new BorderLayout()); southPanel.add(expertModeHintLabel, BorderLayout.CENTER); compatibilityLabel.setLabelFor(compatibilityLevelSpinner); compatibilityLevelSpinner.setPreferredSize( new Dimension(80, (int) compatibilityLevelSpinner.getPreferredSize().getHeight())); compatibilityPanel.add(compatibilityLabel); compatibilityPanel.add(compatibilityLevelSpinner); southPanel.add(compatibilityPanel, BorderLayout.SOUTH); dockableComponent.add(southPanel, BorderLayout.SOUTH); } return dockableComponent; }
private void initComponents() { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // If Nimbus is not available, you can set the GUI to another look and feel. } usernameLabel = new JLabel(); usernameField = new JTextField(); chatroomScrollPane = new JScrollPane(); chatroomArea = new JTextArea(); chatMsgLabel = new JLabel(); chatMsgField = new JTextField(); chatIPLabel = new JLabel(); chatIPField = new JTextField(); portLabel = new JLabel(); portField = new JTextField(); joinButton = new JToggleButton(); sendButton = new JButton(); leaveButton = new JButton(); exitButton = new JButton(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); usernameLabel.setText("Username:"******" "); chatroomArea.setEditable(false); chatroomArea.setColumns(20); chatroomArea.setRows(5); chatroomScrollPane.setViewportView(chatroomArea); chatMsgLabel.setText("Chat Message:"); chatIPLabel.setText("Chat Group IP"); chatIPField.setText("224.27.43.188"); portLabel.setText("Port"); portField.setText("4001"); joinButton.setText("JOIN CHAT"); joinButton.addActionListener(this); sendButton.setText("SEND MESSAGE"); sendButton.addActionListener(this); leaveButton.setText("LEAVE CHAT"); leaveButton.addActionListener(this); exitButton.setText("EXIT"); exitButton.addActionListener(this); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(usernameLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent( usernameField, GroupLayout.PREFERRED_SIZE, 83, GroupLayout.PREFERRED_SIZE)) .addComponent(chatroomScrollPane) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addComponent(chatMsgLabel) .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED) .addComponent( chatMsgField, GroupLayout.PREFERRED_SIZE, 296, GroupLayout.PREFERRED_SIZE)) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup( GroupLayout.Alignment.TRAILING, false) .addComponent( chatIPField, GroupLayout.Alignment.LEADING) .addComponent( chatIPLabel, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup( layout .createParallelGroup( GroupLayout.Alignment.LEADING, false) .addComponent( portField, GroupLayout.DEFAULT_SIZE, 46, Short.MAX_VALUE) .addComponent( portLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup( layout .createParallelGroup( GroupLayout.Alignment.LEADING, false) .addGroup( layout .createSequentialGroup() .addComponent(leaveButton) .addGap(18, 18, 18) .addComponent( exitButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup( layout .createSequentialGroup() .addComponent( joinButton, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(sendButton))))) .addGap(0, 8, Short.MAX_VALUE))) .addContainerGap())); layout.setVerticalGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(usernameField) .addComponent( usernameLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(3, 3, 3) .addComponent( chatroomScrollPane, GroupLayout.PREFERRED_SIZE, 178, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent( chatMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( chatMsgField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(chatIPLabel) .addComponent(portLabel)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent( chatIPField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent( portField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addGroup( layout .createSequentialGroup() .addGap(16, 16, 16) .addGroup( layout .createParallelGroup( GroupLayout.Alignment.LEADING, false) .addComponent( joinButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( sendButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(8, 8, 8) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(leaveButton) .addComponent(exitButton)))) .addGap(17, 17, 17))); pack(); setVisible(true); }
void setCardAmount(DevCardType cardType, int amount) { JToggleButton button = devCards.get(cardType); button.setText(Integer.toString(amount)); }