/** Listener to handle button actions */ public void actionPerformed(ActionEvent e) { // Check if the user changed the service filter option if (e.getSource() == service_box) { service_list.setEnabled(service_box.isSelected()); service_list.clearSelection(); remove_service_button.setEnabled(false); add_service_field.setEnabled(service_box.isSelected()); add_service_field.setText(""); add_service_button.setEnabled(false); } // Check if the user pressed the add service button if ((e.getSource() == add_service_button) || (e.getSource() == add_service_field)) { String text = add_service_field.getText(); if ((text != null) && (text.length() > 0)) { service_data.addElement(text); service_list.setListData(service_data); } add_service_field.setText(""); add_service_field.requestFocus(); } // Check if the user pressed the remove service button if (e.getSource() == remove_service_button) { Object[] sels = service_list.getSelectedValues(); for (int i = 0; i < sels.length; i++) { service_data.removeElement(sels[i]); } service_list.setListData(service_data); service_list.clearSelection(); } }
void jListOnlineUsers_mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { jTextFieldTargetUser.setText(((HostItem) jListOnlineUsers.getSelectedValue()).name); Flasher.instance().flashBackground(jTextFieldTargetUser, Color.yellow, 2); jTextFieldSendMessages.requestFocus(); } }
private void myInit(SanBootView _view, Backupable _bakable, int _mode, int _type) { view = _view; bakable = _bakable; mode = _mode; type = _type; setupProfileType(); setupList(); setupLanguage(); if (mode == ProfileChooser.MODE_SAVEAS || mode == ProfileChooser.MODE_SAVE) { saveAsProfile = new UniProfile(); nameTextField.requestFocus(); } }
void jTextFieldSendSubject_keyPressed(KeyEvent e) { if (e.getKeyCode() == e.VK_DOWN) { String s = subjectHistory.forward(); if (s != null) { jTextFieldSendSubject.setText(s); } } else if (e.getKeyCode() == e.VK_UP) { String s = subjectHistory.back(); if (s != null) { jTextFieldSendSubject.setText(s); } } else if (e.getKeyChar() == '\n') { jTextFieldSendMessages.requestFocus(); } }
private void myInit2( SanBootView _view, Backupable _bakable, int _mode, int _type, BootHost host) { view = _view; bakable = _bakable; mode = _mode; type = _type; setupProfileType(); setupList(); setupLanguage(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); Date date = new Date(); String time = df.format(date); System.out.println(host.getID() + "-" + time); nameTextField.setText(host.getID() + "-" + time); if (mode == ProfileChooser.MODE_SAVEAS || mode == ProfileChooser.MODE_SAVE) { saveAsProfile = new UniProfile(); nameTextField.requestFocus(); } }
public void setReady() { textField.setEditable(true); textField.requestFocus(); }