/** 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(); } }
private void loadFloor() { if (currentFloor == null) return; isLoading = true; blendingCheckbox.setSelected(currentFloor.occlude); switch (previewBox.getMode()) { case RT3_GAME: gameColour.setColour(currentFloor.colour2); gameTexture.setValue(currentFloor.texture); gameName.setText(currentFloor.name); break; case RT3_MAP: gameColour.setColour(currentFloor.minimapColour); gameTexture.setValue(currentFloor.texture); gameName.setText(currentFloor.name); break; case RT4P_OVERLAY: gameColour.setColour(currentFloor.hdColour); gameTexture.setValue(currentFloor.hdTexture); // gameName.setText(currentFloor.name); break; case RT4P_UNDERLAY: gameColour.setColour(currentFloor.hdUlColour); gameTexture.setValue(currentFloor.hdUlTexture); // gameName.setText(currentFloor.name); break; } isLoading = false; previewBox.repaint(); }
/** Creates new form SIPHeadersParametersFrame */ public StackPanel(ConfigurationFrame configurationFrame, ProxyLauncher proxyLauncher) { super(); this.parent = configurationFrame; this.proxyLauncher = proxyLauncher; listeningPointsList = new ListeningPointsList(proxyLauncher); initComponents(); // Init the components input: try { Configuration configuration = proxyLauncher.getConfiguration(); if (configuration == null) return; if (configuration.stackName != null) proxyStackNameTextField.setText(configuration.stackName); if (configuration.stackIPAddress != null) proxyIPAddressTextField.setText(configuration.stackIPAddress); if (configuration.outboundProxy != null) outboundProxyTextField.setText(configuration.outboundProxy); if (configuration.routerPath != null) routerClassTextField.setText(configuration.routerPath); if (configuration == null) listeningPointsList.displayList(new Hashtable()); else listeningPointsList.displayList(configuration.listeningPoints); } catch (Exception e) { e.printStackTrace(); } }
/** Loads the default settings from Preferences to set up the dialog. */ public void legacyLoadDefaults() { String defaultsString = Preferences.getDialogDefaults(getDialogName()); if ((defaultsString != null) && (newImage != null)) { try { StringTokenizer st = new StringTokenizer(defaultsString, ","); textSearchWindowSide.setText("" + MipavUtil.getInt(st)); textSimilarityWindowSide.setText("" + MipavUtil.getInt(st)); textNoiseStandardDeviation.setText("" + MipavUtil.getFloat(st)); textDegree.setText("" + MipavUtil.getFloat(st)); doRician = MipavUtil.getBoolean(st); doRicianCheckBox.setSelected(doRician); textDegree.setEnabled(doRician); labelDegree.setEnabled(doRician); image25DCheckBox.setSelected(MipavUtil.getBoolean(st)); if (MipavUtil.getBoolean(st)) { newImage.setSelected(true); } else { replaceImage.setSelected(true); } } catch (Exception ex) { // since there was a problem parsing the defaults string, start over with the original // defaults Preferences.debug("Resetting defaults for dialog: " + getDialogName()); Preferences.removeProperty(getDialogName()); } } }
// Clear text fields public void returnToRental() { idTextField.setText(""); quantityTextField.setText(""); dateTextField.setText("MM/DD/YYYY"); totalItems.setText(""); totalCost.setText(""); }
public void syncPanel() { panelPat.syncPanel(); regionAButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.A); regionBButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.B); regionCButton.setBorderPainted(dlg.panelMain.mark.getRegion() == Reg.C); elevBox.setText(dlg.panelMain.mark.getElevation()); heightBox.setText(dlg.panelMain.mark.getObjectHeight()); sourceBox.setText(dlg.panelMain.mark.getSource()); infoBox.setText(dlg.panelMain.mark.getInfo()); for (Sts sts : statuses.keySet()) { int item = statuses.get(sts); if (dlg.panelMain.mark.getStatus() == sts) statusBox.setSelectedIndex(item); } for (Cns cns : constructions.keySet()) { int item = constructions.get(cns); if (dlg.panelMain.mark.getConstr() == cns) constrBox.setSelectedIndex(item); } for (Con con : conspicuities.keySet()) { int item = conspicuities.get(con); if (dlg.panelMain.mark.getConsp() == con) conBox.setSelectedIndex(item); } for (Con con : reflectivities.keySet()) { int item = reflectivities.get(con); if (dlg.panelMain.mark.getRefl() == con) reflBox.setSelectedIndex(item); } }
public void clrFields() { tfClave.setText(""); tfNombre.setText(""); tfExistencia.setText(""); tfMarca.setText(""); tfPrecio.setText(""); }
private void sendRequest(BlockPdu pdu) { setButton.setEnabled(false); getButton.setEnabled(false); getNextButton.setEnabled(false); lmessage.setText("Sending request .."); lmessage.setBackground(Color.white); try { varbind var = pdu.getResponseVariableBinding(); AsnObjectId oid = var.getOid(); AsnObject res = var.getValue(); if (res != null) { toid.setText(oid.toString()); tvalue.setText(res.toString()); lmessage.setText("Received aswer "); lmessage.setBackground(Color.white); } else { lmessage.setText("Received no aswer "); lmessage.setBackground(Color.red); } } catch (PduException exc) { lmessage.setText("PduException: " + exc.getMessage()); lmessage.setBackground(Color.red); exc.printStackTrace(); } catch (java.io.IOException exc) { lmessage.setText("IOException: " + exc.getMessage()); lmessage.setBackground(Color.red); exc.printStackTrace(); } setButton.setEnabled(true); getButton.setEnabled(true); getNextButton.setEnabled(true); }
private void parseDirective(String directive) { if (directive == null) { System.err.println("Directive is null."); return; } String[] pair = directive.split("="); if (pair == null || pair.length != 2) { System.err.println("Unable to parse directive: \"" + directive + "\" Ignored."); return; } String key = pair[0].trim(), value = pair[1].trim(); // clean these, might have too much whitespace around commas if (validKeys.indexOf(key) == FONT || validKeys.indexOf(key) == PRELOAD) { value = value.replaceAll("[\\s]*,[\\s]*", ","); } if (validKeys.indexOf(key) == -1) { System.err.println("Directive key not recognized: \"" + key + "\" Ignored."); return; } if (value.equals("")) { System.err.println("Directive value empty. Ignored."); return; } value = value.replaceAll("^\"|\"$", "").replaceAll("^'|'$", ""); // System.out.println( key + " = " + value ); boolean v; switch (validKeys.indexOf(key)) { case CRISP: v = value.toLowerCase().equals("true"); crispBox.setSelected(v); break; case FONT: fontField.setText(value); break; case GLOBAL_KEY_EVENTS: v = value.toLowerCase().equals("true"); globalKeyEventsBox.setSelected(v); break; case PAUSE_ON_BLUR: v = value.toLowerCase().equals("true"); pauseOnBlurBox.setSelected(v); break; case PRELOAD: preloadField.setText(value); break; case TRANSPARENT: v = value.toLowerCase().equals("true"); // transparentBox.setSelected(v); break; } }
private void rodytiAutoRinkinius() { zonaNeregAuto.setText(""); for (Automobilis a : rg.neregAuto) zonaNeregAuto.append(a.toString() + "\n"); zonaRegAuto.setText(""); for (Map.Entry<String, Automobilis> me : rg.regAuto.entrySet()) zonaRegAuto.append(String.format("%8s=%s\n", me.getKey(), me.getValue())); tfNeregKiekis.setText(Integer.toString(rg.neregAuto.size())); tfRegKiekis.setText(Integer.toString(rg.regAuto.size())); }
private void extraInit() { addSynapses(); jTextFieldDelay.setText(mySynProps.getDelayGenerator().toShortString()); jTextFieldWeights.setText(mySynProps.getWeightsGenerator().toShortString()); jTextFieldThreshold.setText(mySynProps.getThreshold() + ""); jComboBoxSynapseType.setSelectedItem(mySynProps.getSynapseType()); }
private void mostrar(String str) { StringTokenizer st = new StringTokenizer(str, "_"); clave = st.nextToken(); nombre = st.nextToken(); marca = st.nextToken(); existencia = st.nextToken(); precio = st.nextToken(); tfClave.setText(clave); tfNombre.setText(nombre); tfMarca.setText(marca); tfExistencia.setText(existencia); tfPrecio.setText(precio); }
private void setCurrentDirectory(File file) { if (file == null) { currentDirectoryTextField.setText(""); settingsNode.setValueOfChild(CURRENT_DIRECTORY, ""); } else { currentDirectoryTextField.setText(file.getAbsolutePath()); settingsNode.setValueOfChild(CURRENT_DIRECTORY, file.getAbsolutePath()); } if (gradlePluginLord.setCurrentDirectory(file)) { // refresh the tasks only if we actually changed the current directory gradlePluginLord.addRefreshRequestToQueue(); } }
/** Loading the values stored into configuration form */ private void loadValues() { PacketLoggingService packetLogging = LoggingUtilsActivator.getPacketLoggingService(); PacketLoggingConfiguration cfg = packetLogging.getConfiguration(); enableCheckBox.setSelected(cfg.isGlobalLoggingEnabled()); sipProtocolCheckBox.setSelected(cfg.isSipLoggingEnabled()); jabberProtocolCheckBox.setSelected(cfg.isJabberLoggingEnabled()); rtpProtocolCheckBox.setSelected(cfg.isRTPLoggingEnabled()); ice4jProtocolCheckBox.setSelected(cfg.isIce4JLoggingEnabled()); fileCountField.setText(String.valueOf(cfg.getLogfileCount())); fileSizeField.setText(String.valueOf(cfg.getLimit() / 1000)); updateButtonsState(); }
@Override public void actionPerformed(ActionEvent e) { String chosen; chosen = JOptionPane.showInputDialog(Localization.lang("Choose the URL to download."), ""); if (chosen == null) { return; } File toFile; try { String toName = FileDialogs.getNewFile( frame, new File(System.getProperty("user.home")), null, JFileChooser.SAVE_DIALOG, false); if (toName == null) { return; } else { toFile = new File(toName); } URL url = new URL(chosen); MonitoredURLDownload.buildMonitoredDownload(comp, url).downloadToFile(toFile); comp.setText(toFile.getPath()); } catch (Exception ex) { JOptionPane.showMessageDialog( null, Localization.lang("Error downloading file '%0'", chosen), Localization.lang("Download failed"), JOptionPane.ERROR_MESSAGE); } }
/** {@inheritDoc} */ public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column) { BranchDescriptor d = myBranches.get(row); myInvalidValues = d.existingBranches; myTextField.setText(d.newBranchName == null ? "" : d.newBranchName); return myPanel; }
/** * Call this to set a custom gradle executor. We'll enable all fields appropriately and setup the * foundation settings. We'll also fire off a refresh. * * @param file the file to use as a custom executor. Null not to use one. */ private void setCustomGradleExecutor(File file) { String storagePath; boolean isUsingCustom = false; if (file == null) { isUsingCustom = false; storagePath = null; } else { isUsingCustom = true; storagePath = file.getAbsolutePath(); } // set the executor in the foundation if (gradlePluginLord.setCustomGradleExecutor(file)) { // refresh the tasks only if we actually changed the executor gradlePluginLord.addRefreshRequestToQueue(); } // set the UI values useCustomGradleExecutorCheckBox.setSelected(isUsingCustom); customGradleExecutorField.setText(storagePath); // enable the UI appropriately. browseForCustomGradleExecutorButton.setEnabled(isUsingCustom); customGradleExecutorField.setEnabled(isUsingCustom); // store the settings settingsNode.setValueOfChild(CUSTOM_GRADLE_EXECUTOR, storagePath); }
private void setTextToFile(final LookupFile file) { String text = file.getAbsolutePath(); if (file.isDirectory() && !text.endsWith(myFinder.getSeparator())) { text += myFinder.getSeparator(); } myPathTextField.setText(text); }
void handleScanFiles(JTextField field, String[] extensions) { String[] dataFiles = scanDataFolderForFilesByType(extensions); if (dataFiles == null || dataFiles.length == 0) return; String[] oldFileList = field.getText().trim().split(","); ArrayList<String> newFileList = new ArrayList<String>(); for (String c : oldFileList) { c = c.trim(); if (!c.equals("") && newFileList.indexOf(c) == -1) // TODO check exists() here? { newFileList.add(c); } } for (String c : dataFiles) { c = c.trim(); if (!c.equals("") && newFileList.indexOf(c) == -1) { newFileList.add(c); } } Collections.sort(newFileList); String finalFileList = ""; int i = 0; for (String s : newFileList) { finalFileList += (i > 0 ? ", " : "") + s; i++; } field.setText(finalFileList); }
private void completePanel() { if (criterion != null) { jtfCode.setText(criterion.getCode()); jtfCode.setEditable(false); jtfLibelle.setText(criterion.getLibelle()); jcbSortOrder.setSelectedIndex((criterion.getSortOrder() > 0) ? 0 : 1); jcbPlacementCriterion.setSelected(criterion.isPlacement()); jcbClassementCriterion.setSelected(criterion.isClassement()); jcbSortOrder.setEnabled(!parent.getWorkConfiguration().isOfficialProfile()); jcbPlacementCriterion.setEnabled(!parent.getWorkConfiguration().isOfficialProfile()); jcbClassementCriterion.setEnabled(!parent.getWorkConfiguration().isOfficialProfile()); } }
public boolean stopCellEditing() { Object descrip = null, costo = null; JTextField campo = ((JTextField) this.getComponent()); String codigo = campo.getText(); if (codigo == "") { return false; } descrip = Almacenes.groovyPort( "omoikane.principal.Articulos.getArticulo('codigo = \"" + codigo + "\"').descripcion"); costo = Almacenes.groovyPort( "omoikane.principal.Articulos.getArticulo('select * from articulos,precios where articulos.codigo = \"" + codigo + "\" " + "and articulos.id_articulo = precios.id_articulo and precios.id_almacen = '+omoikane.principal.Principal.config.idAlmacen[0].text()).costo"); if (descrip == null) { Dialogos.lanzarAlerta("El artículo que capturó no exíste"); campo.setText(""); return false; } else { tablaPrincipal.setValueAt( descrip, tablaPrincipal.getEditingRow(), tablaPrincipal.getEditingColumn() + 1); tablaPrincipal.setValueAt( costo, tablaPrincipal.getEditingRow(), tablaPrincipal.getEditingColumn() + 2); return super.stopCellEditing(); } }
Server() { setSize(500, 100); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); thread = new Thread(this); clientList = new ArrayList<ClientData>(); sList = new ArrayList<ServerThread>(); JPanel panel = new JPanel(); panel.add(new JLabel("Port :")); portText = new JTextField(5); portText.setText("7777"); panel.add(portText); startButton = new JButton("Start server"); startButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { try { port = Integer.parseInt(portText.getText()); thread.start(); startButton.setEnabled(false); } catch (NumberFormatException ex) { JOptionPane.showMessageDialog(null, "B³êdny format numeru portu"); portText.setText(""); } } }); panel.add(startButton); l = new JLabel("Serwer jest nieaktywny"); panel.add(l); add(panel, BorderLayout.NORTH); }
/** * Used to initialize the componenets. Also called after every event that is required to update * other fields. */ public void setup() { if (firstTime) { defaultDirBackupPath = convertSet.getBackupPath().getPath(); defaultOneFileBackupPath = System.getProperty("user.dir"); firstTime = false; } dirTF.setText(convertSet.getSourcePath().getPath()); recursiveCheckBox.setSelected(converter.isRecurse()); if (converter.isStaticVersioning()) { staticVersioningRadioButton.setSelected(true); } else { dynamicVersioningRadioButton.setSelected(true); } backupTF.setText(defaultDirBackupPath); }
@Override public void keyPressed(KeyEvent e) { // frm.repaint(); strgr = txter.getText(); taken = strgr.length(); chl = strgr.charAt(taken - 1); // strgr = ""; txter.setText(strgr); if (chl == 'a') { my_car.row -= 10; System.out.println(my_car.row); } if (chl == 'd') { my_car.row += 10; System.out.println(my_car.row); } if (chl == 'w') { my_car.col -= 10; System.out.println(my_car.col); } if (chl == 's') { my_car.col += 10; System.out.println(my_car.col); } System.out.println(chl); }
/** * Sets the text of this text field. * * @param text the text to show in this text field */ public void setText(String text) { if ((text == null || text.length() == 0) && !isFocusOwner()) setDefaultText(); else { this.setForeground(foregroundColor); super.setText(text); } }
void jButtonWeights_actionPerformed(ActionEvent e) { NumberGeneratorDialog dlg = new NumberGeneratorDialog( (Frame) null, "Weights", "Weight of synaptic connections", mySynProps.getWeightsGenerator(), true); // Center the window Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = dlg.getSize(); if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; } if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; } dlg.setLocation( (screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); dlg.setVisible(true); jTextFieldWeights.setText(mySynProps.getWeightsGenerator().toShortString()); // mySynProps.setWeightsGenerator(dlg.getFinalNumGen()); }
private Component createCurrentDirectoryPanel() { currentDirectoryTextField = new JTextField(); currentDirectoryTextField.setEditable(false); String currentDirectory = settingsNode.getValueOfChild(CURRENT_DIRECTORY, null); if (currentDirectory == null || "".equals(currentDirectory.trim())) { currentDirectory = gradlePluginLord.getCurrentDirectory().getAbsolutePath(); } currentDirectoryTextField.setText(currentDirectory); gradlePluginLord.setCurrentDirectory(new File(currentDirectory)); JButton browseButton = new JButton( new AbstractAction("Browse...") { public void actionPerformed(ActionEvent e) { File file = browseForDirectory(gradlePluginLord.getCurrentDirectory()); if (file != null) { setCurrentDirectory(file); } } }); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(Utility.addLeftJustifiedComponent(new JLabel("Current Directory"))); panel.add(createSideBySideComponent(currentDirectoryTextField, browseButton)); return panel; }
void connectionFailed() { login.setEnabled(true); logout.setEnabled(false); // whoIsIn.setEnabled(false); chatStatus.setText("Please login first"); chatField.setText(""); // reset port number and host name as a construction time tfPort.setText("" + defaultPort); tfServer.setText(defaultHost); // let the user change them tfServer.setEditable(false); tfPort.setEditable(false); // don't react to a <CR> after the username chatField.removeActionListener(this); connected = false; }
// ボタンが押されたときのイベント処理 public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if (cmd.equals("submit")) { // 送信 sendMessage("msg " + msgTextField.getText()); msgTextField.setText(""); } else if (cmd.equals("rename")) { // 名前の変更 sendMessage("setName " + nameTextField.getText()); } else if (cmd.equals("addRoom")) { // 部屋を作成 String roomName = nameTextField.getText(); sendMessage("addRoom " + roomName); enteredRoom(roomName); sendMessage("getUsers " + roomName); } else if (cmd.equals("enterRoom")) { // 入室 Object room = roomList.getSelectedValue(); if (room != null) { String roomName = room.toString(); sendMessage("enterRoom " + roomName); enteredRoom(roomName); } } else if (cmd.equals("exitRoom")) { // 退室 sendMessage("exitRoom " + roomName); exitedRoom(); } }
public void actionPerformed(ActionEvent e) { if (e.getSource() == from) { String tmpFrom = from.getText().trim(); String tmpTo = to.getText().trim(); if (tmpFrom.equals("MST") || tmpFrom.equals("mst")) findMinSpan(); else { try { // check if from exists // String str = from.getText(); // fixa så man kan skippa att skriva första med stor bokstav tmpFrom = Character.toUpperCase(tmpFrom.charAt(0)) + tmpFrom.substring(1); int pos = noderna.findLeading(tmpFrom).getNodeNo(); route.setText(introText + "\n"); from.setText(noderna.find(pos).toString()); } catch (NullPointerException npe) { route.setText(felTextStart + "\n"); return; } if (!tmpTo.equals("")) { findShort(); } } } else if (e.getSource() == to) { String tmpFrom = from.getText().trim(); String tmpTo = to.getText().trim(); if (tmpTo.equals("MST") || tmpTo.equals("mst")) findMinSpan(); else { try { // check if to exists // String str = to.getText(); tmpTo = Character.toUpperCase(tmpTo.charAt(0)) + tmpTo.substring(1); int pos = noderna.findLeading(tmpTo).getNodeNo(); route.setText(introText + "\n"); to.setText(noderna.find(pos).toString()); } catch (NullPointerException npe) { route.setText(felTextStart + "\n"); return; } if (!tmpFrom.equals("")) { findShort(); } } /* else if ( ! from.getText().equals("") ) findShort(); */ } }