@Override public void profileSelectionChanged(final Optional<MutableProfile> profile) { okButton.setEnabled(model.isSaveAllowed()); deleteProfile.setEnabled(model.getSelectedProfile().isPresent()); if (profile.isPresent()) { final int index = profilesModel.indexOf(profile.get()); selectionModel.setLeadSelectionIndex(index); } else { selectionModel.setLeadSelectionIndex(-1); } addNickname.setEnabled(model.getSelectedProfile().isPresent()); editNickname.setEnabled(model.getSelectedProfile().isPresent()); addHighlight.setEnabled(model.getSelectedProfile().isPresent()); editHighlight.setEnabled(model.getSelectedProfile().isPresent()); name.setEnabled(model.getSelectedProfile().isPresent()); name.setText(model.getSelectedProfileName().orElse("")); nicknames.setEnabled(model.getSelectedProfile().isPresent()); nicknamesModel.clear(); nicknamesModel.addAll(model.getSelectedProfileNicknames().orElse(Lists.newArrayList())); highlights.setEnabled(model.getSelectedProfile().isPresent()); highlightsModel.clear(); highlightsModel.addAll(model.getSelectedProfileHighlights().orElse(Lists.newArrayList())); realname.setEnabled(model.getSelectedProfile().isPresent()); realname.setText(model.getSelectedProfileRealname().orElse("")); ident.setEnabled(model.getSelectedProfile().isPresent()); ident.setText(model.getSelectedProfileIdent().orElse("")); }
public PathProperPanel(final PathLayer layer, final DartEarthAppFrame frame) { this.setLayout(new GridLayout(0, 1, 2, 2)); this.layer = layer; this.frame = frame; this.path = layer.getPath(); deleteBtns = new ArrayList<JButton>(); latTexts = new ArrayList<JTextField>(); lngTexts = new ArrayList<JTextField>(); pointPanels = new ArrayList<JPanel>(); layerNameLabel = new JLabel("图层名:"); layerNameTextField = new JTextField(); layerNameTextField.setText(layer.getName()); put(layerNameLabel, layerNameTextField); // this.buildPointPanels(); colorLabel = new JLabel("颜色:"); // this.add(colorLabel); // colorChooser = new JColorChooser(); color = path.getAttributes().getOutlineMaterial().getDiffuse(); // colorChooser.setColor(color); // colorChooser.set // color=JColorChooser.showDialog(this, "请选择颜色", color); colorBtn = new JButton(); // colorBtn.setText(""); colorBtn.setBackground(color); // final LineProperPanel panel = this; ActionListener colorChooseListener = new ActionListener() { @Override public void actionPerformed(ActionEvent event) { Color choosenColor = JColorChooser.showDialog(null, "请选择颜色", color); colorBtn.setBackground(choosenColor); // line.setColor(color); // layer.refresh(); } }; colorBtn.addActionListener(colorChooseListener); put(colorLabel, colorBtn); // this.add(colorBtn); opacityLabel = new JLabel("透明度:"); // this.add(opacityLable); opacityTextField = new JTextField(); opacityTextField.setText(layer.getPath().getAttributes().getOutlineOpacity() + ""); // this.add(opacityTextField); put(opacityLabel, opacityTextField); sizeLabel = new JLabel("粗细:"); // this.add(sizeLabel); sizeTextField = new JTextField(); sizeTextField.setText(path.getAttributes().getOutlineWidth() + ""); // this.add(sizeTextField); put(sizeLabel, sizeTextField); initialDialogBtns(); buildPointPanels(); }
private void refreshContents(String environment) { MDFClientConfigRepository repository = MDFClientConfigurator.getInstance().getConfigRepository(); MDFClientEnvConfigRepository envConfig = repository.getConfig(environment); textTcpAddress.setText(envConfig.getTcpInfo().getEndPointInfo().getDisplayable()); userName.setPreferredSize(fieldSize); password.setPreferredSize(fieldSize); userName.setText(envConfig.getTcpInfo().getUserName()); password.setText(envConfig.getTcpInfo().getPassword()); /* String networkInterface=repository.getMDFClientRuntimeParameters().getMulticastNetworkInterface(); if(networkInterface!=null) { textMulticastNetworkInterface.setText(networkInterface); } else { textMulticastNetworkInterface.setText("<default>"); } textSequenceProblemAction.setText(repository.getMDFClientRuntimeParameters().getSequenceProblemAction().getAction()); textMulticastInactivityThreshold.setText(Integer.toString(repository.getMDFClientRuntimeParameters().getMulticastInactivityThreshold())); */ return; }
private void setParamFromField() { String value = widget.getText(); if (D) System.out.println("New Value = " + value); try { Long val; if (value.equals("")) val = null; else val = Long.parseLong(value); setValue(val); refreshParamEditor(); widget.validate(); widget.repaint(); } catch (NumberFormatException ee) { if (D) System.out.println("Error = " + ee.toString()); Long obj = getValue(); if (obj == null) widget.setText(""); else widget.setText(obj.toString()); this.unableToSetValue(value); } catch (ConstraintException ee) { if (D) System.out.println("Error = " + ee.toString()); Long obj = getValue(); if (obj == null) widget.setText(""); else widget.setText(obj.toString()); this.unableToSetValue(value); } catch (WarningException ee) { refreshParamEditor(); widget.validate(); widget.repaint(); } }
//// *******************方法部分*************///////////// // 设置JTextField里面显示商品信息的方法 public void pDisplay( String productNo, String productName, String productClass, String productPrice) { JT_pno.setText(productNo); JT_pname.setText(productName); JT_pclass.setText(productClass); JT_pprice.setText(productPrice); }
/** 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(); } }
public void setParam() { subghzBaud.setSelectedItem(Param.subghzBaud); subghzChannel.setSelectedItem(Param.subghzChannel); subghzPanid.setText(Param.subghzPanid); subghzTxAddr.setText(Param.subghzStrTxaddr); subghzPwr.setSelectedItem(Param.subghzPwr); }
// Вид формы при изменении материала public void materialDiaUpdate(Material m) { label_id_hidden.setText(Integer.toString(m.getId_materiala())); textField_name.setText(m.getNazvanie()); textField_ed_izm.setText(m.getEdinica_izmereniya()); textField_price.setText(m.getPrice().toString()); textField_kolvo.setText(m.getKolvo().toString()); }
public boolean inserir(ChefeEquipe chefe) { try { this.chefeEquipe = chefe; txtIdFuncionario.setText(String.valueOf(chefe.getChefe().getId())); txtNomeFuncionario.setText(String.valueOf(chefe.getChefe().getNome())); txtPromissoria.setText(String.valueOf(chefe.getValeChefe())); float perVen = chefe.getPercentualVenda(); txtPercVenda.setText(String.valueOf(perVen)); float perCob = chefe.getPercentualCobranca(); txtPercCobr.setText(String.valueOf(perCob)); float venda = equipe.getVenda().getVendaPraso(); txtTotalVend.setText(String.valueOf(venda)); float cobrado = equipe.getCobranca().getRecebidoTotal(); txtTotalRecbido.setText(String.valueOf(cobrado)); float comVend = perVen * venda / 100; txtComissaoVenda.setText(String.valueOf(comVend)); float comCob = cobrado * comVend / 100; txtTotalComissaoCobranca.setText(String.valueOf(comCob)); float saldoQuitacao = comCob - comVend; txtSandoQuitacao.setText(String.valueOf(saldoQuitacao)); return true; } catch (Exception e) { JOptionPane.showMessageDialog(contentPanel, e.getMessage()); return false; } }
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == reset) { fn.setText(null); vn.setText(null); m.setSelected(false); w.setSelected(false); } if (e.getSource() == ok) { String s = fn.getText(); System.out.println(s); String s1 = vn.getText(); System.out.println(s1); } if (m.isSelected()) { System.out.println("männlich"); System.out.println(" "); } else { if (w.isSelected()) { System.out.println("weiblich"); System.out.println(" "); } if (e.getSource() == exit) { System.exit(0); } repaint(); } }
@Override public void actualiza(Acciones evento, Retorno datos) { switch (evento) { case proveedoresConsultar: if (!datos.tieneErrores()) { TransferProveedor cliente = (TransferProveedor) datos.getDatos(); labelId.setText("" + cliente.getId()); cajaNombre.setText(cliente.getName()); cajaTelefono.setText("" + cliente.getTelephoneNumber()); cajaEmail.setText(cliente.getEmail()); cajaNIF.setText("" + cliente.getNif()); } else { JOptionPane.showMessageDialog(this, "Error al consultar proveedor."); this.dispose(); } break; case proveedoresEditar: if (!datos.tieneErrores()) { JOptionPane.showMessageDialog(this, "Proveedor modificado correctamente."); this.dispose(); } else { JOptionPane.showMessageDialog(this, "Error modificando los datos del Proveedor."); this.dispose(); } break; } }
private void resetSettings() { downloadDirectoryTextField.setText(Groovesquid.getConfig().getDownloadDirectory()); maxParallelDownloadsSpinner.setValue(Groovesquid.getConfig().getMaxParallelDownloads()); fileNameSchemeTextField.setText(Groovesquid.getConfig().getFileNameScheme()); String[] downloadCompleteActions = Config.DownloadComplete.names(); DefaultComboBoxModel downloadCompleteComboBoxModel = new DefaultComboBoxModel(); downloadCompletedComboBox.setModel(downloadCompleteComboBoxModel); for (String downloadCompleteAction : downloadCompleteActions) { downloadCompleteComboBoxModel.addElement(I18n.getLocaleString(downloadCompleteAction)); } downloadCompletedComboBox.setSelectedIndex(Groovesquid.getConfig().getDownloadComplete()); String[] startTabs = Config.StartTab.names(); DefaultComboBoxModel startTabComboBoxModel = new DefaultComboBoxModel(); startTabComboBox.setModel(startTabComboBoxModel); for (String startTab : startTabs) { startTabComboBoxModel.addElement(I18n.getLocaleString(startTab)); } startTabComboBox.setSelectedIndex(Groovesquid.getConfig().getStartTab()); String[] fileExistsActions = Config.FileExists.names(); DefaultComboBoxModel fileExistsComboBoxModel = new DefaultComboBoxModel(); fileExistsComboBox.setModel(fileExistsComboBoxModel); for (String fileExistsAction : fileExistsActions) { fileExistsComboBoxModel.addElement(I18n.getLocaleString(fileExistsAction)); } fileExistsComboBox.setSelectedIndex(Groovesquid.getConfig().getFileExists()); if (Groovesquid.getConfig().getProxyHost() != null && Groovesquid.getConfig().getProxyPort() != null) { proxyHostTextField.setText(Groovesquid.getConfig().getProxyHost()); proxyPortTextField.setText(Groovesquid.getConfig().getProxyPort().toString()); } }
private void onTranslation() { final JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(filePath); fc.setMultiSelectionEnabled(false); final int returnVal = fc.showOpenDialog(panel); filePath = fc.getCurrentDirectory(); if (returnVal == JFileChooser.APPROVE_OPTION) { translationFilePath = fc.getSelectedFile(); if (fc.getName(translationFilePath).endsWith(".txt")) { if (translationFilePath.exists()) { translationDoc = fc.getName(translationFilePath); fieldTranslation.setText(translationFilePath.getPath()); } else { JOptionPane.showMessageDialog( panel, getString("MSG.ERROR.FILE_NOTFOUND"), getString("MSG.ERROR"), JOptionPane.ERROR_MESSAGE); fieldTranslation.setText(""); } } // ToDo: remember filename by preferences } }
/** Loads dialog fields. */ private void load() { oldThreshold = String.valueOf(controller.getFuzzyThreshold()); oldMaxResults = String.valueOf(controller.getMaxResults()); txtFuzzyThreshold.setText(oldThreshold); txtMaxResultNum.setText(oldMaxResults); }
private void selectFile() { File f = rest_ui.getOpenFile(FileChooserType.OPEN_REQUEST_BODY); if (f == null) { // Pressed cancel? return; } if (!f.canRead()) { JOptionPane.showMessageDialog( rest_ui.getFrame(), "File not readable: " + f.getAbsolutePath(), "IO Error", JOptionPane.ERROR_MESSAGE); return; } // Content type charset correction: ContentTypeSelectorOnFile.select(jp_contentType, f, this); // Set name: if (StringUtil.isEmpty(jtf_fileName.getText())) { jtf_fileName.setText(f.getName()); } // Set file: jtf_file.setText(f.getAbsolutePath()); }
public void actionPerformed(ActionEvent e) { PosButton button = (PosButton) e.getSource(); String s = button.getActionCommand(); if (s.equals("CLEAR")) { tfAmountTendered.setText("0"); } else if (s.equals(".")) { if (tfAmountTendered.getText().indexOf('.') < 0) { tfAmountTendered.setText(tfAmountTendered.getText() + "."); } } else { String string = tfAmountTendered.getText(); int index = string.indexOf('.'); if (index < 0) { double value = 0; try { value = Double.parseDouble(string); } catch (NumberFormatException x) { Toolkit.getDefaultToolkit().beep(); } if (value == 0) { tfAmountTendered.setText(s); } else { tfAmountTendered.setText(string + s); } } else { tfAmountTendered.setText(string + s); } } }
// Вид формы при добавлении нового материала public void materialDiaInsert() { label_id_hidden.setText("Новый материал"); textField_name.setText(""); textField_ed_izm.setText(""); textField_price.setText(""); textField_kolvo.setText(""); }
public void clrFields() { tfClave.setText(""); tfNombre.setText(""); tfExistencia.setText(""); tfMarca.setText(""); tfPrecio.setText(""); }
@Override public void reset(@NotNull HttpConfigurable settings) { myNoProxyRb.setSelected(true); // default myAutoDetectProxyRb.setSelected(settings.USE_PROXY_PAC); myPacUrlCheckBox.setSelected(settings.USE_PAC_URL); myPacUrlTextField.setText(settings.PAC_URL); myUseHTTPProxyRb.setSelected(settings.USE_HTTP_PROXY); myProxyAuthCheckBox.setSelected(settings.PROXY_AUTHENTICATION); enableProxy(settings.USE_HTTP_PROXY); myProxyLoginTextField.setText(settings.getProxyLogin()); myProxyPasswordTextField.setText(settings.getPlainProxyPassword()); myProxyPortTextField.setNumber(settings.PROXY_PORT); myProxyHostTextField.setText(settings.PROXY_HOST); myProxyExceptions.setText(StringUtil.notNullize(settings.PROXY_EXCEPTIONS)); myRememberProxyPasswordCheckBox.setSelected(settings.KEEP_PROXY_PASSWORD); mySocks.setSelected(settings.PROXY_TYPE_IS_SOCKS); myHTTP.setSelected(!settings.PROXY_TYPE_IS_SOCKS); boolean showError = !StringUtil.isEmptyOrSpaces(settings.LAST_ERROR); myErrorLabel.setVisible(showError); myErrorLabel.setText(showError ? errorText(settings.LAST_ERROR) : null); final String oldStyleText = CommonProxy.getMessageFromProps(CommonProxy.getOldStyleProperties()); myOtherWarning.setVisible(oldStyleText != null); if (oldStyleText != null) { myOtherWarning.setText(oldStyleText); myOtherWarning.setIcon(Messages.getWarningIcon()); } }
private void addItem() { if (!searchName.getText().isEmpty() && !item.getText().isEmpty()) { try { Main.setItem( searchName.getText(), "http://www.reddit.com/r/hardwareswap/search?q=" + item.getText() + "&sort=new&restrict_sr=on"); results.setText("Current Items"); displayInformation(); } catch (IOException e1) { e1.printStackTrace(); } searchName.setText(""); item.setText(""); } else { results.setText("Please provide all info for Item Name, Keyword, and Website"); } }
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 handleNumber(String key) { if (isFirstDigit) display.setText(key); else if ((key.equals(".")) && (display.getText().indexOf(".") < 0)) display.setText(display.getText() + "."); else if (!key.equals(".")) display.setText(display.getText() + key); isFirstDigit = false; }
/* Sjekker om scannet kort finnes og om det er gyldig, og skriver ut om scanningen var gyldig/ugyldig */ private void sjekk() { vindu.getSelgerMetoder().setAktivTilKontroll(); try { int nr = Integer.parseInt(kortid.getText()); Boolean ok = aktivkortreg.sjekkGyldig(nr); if (ok) { info.setText("\n\n Gyldig"); info.setBackground(Color.GREEN); if (scan(ok)) aktivkortreg.fjernKlipp(nr); kortid.setText(""); kortid.selectAll(); resetFocus(); } else { info.setText("\n\n Ikke gyldig"); info.setBackground(Color.RED); scan(ok); kortid.setText(""); kortid.selectAll(); resetFocus(); } aktivkortreg.oppdater(); vindu.oppdaterInfoPanel(); } catch (NumberFormatException e) { info.setText("\n\n Kun tall..."); kortid.setText(""); timer.schedule(new Tick(), timersec * 500); return; } }
/** * Method to display pixel information for the passed x and y * * @param pictureX the x value in the picture * @param pictureY the y value in the picture */ private void displayPixelInformation(int pictureX, int pictureY) { // check that this x and y are in range if (isLocationInPicture(pictureX, pictureY)) { // save the current x and y index colIndex = pictureX; rowIndex = pictureY; // get the pixel at the x and y Pixel pixel = new Pixel(picture, colIndex, rowIndex); // set the values based on the pixel colValue.setText(Integer.toString(colIndex + numberBase)); rowValue.setText(Integer.toString(rowIndex + numberBase)); rValue.setText("R: " + pixel.getRed()); gValue.setText("G: " + pixel.getGreen()); bValue.setText("B: " + pixel.getBlue()); colorPanel.setBackground(new Color(pixel.getRed(), pixel.getGreen(), pixel.getBlue())); } else { clearInformation(); } // notify the image display of the current x and y imageDisplay.setCurrentX((int) (colIndex * zoomFactor)); imageDisplay.setCurrentY((int) (rowIndex * zoomFactor)); }
@Override protected JComponent updateWidget() { Long val = getValue(); if (val == null) widget.setText(""); else widget.setText(val + ""); return widget; }
// Listener method for list selection changes. public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting() == false) { if (list.getSelectedIndex() == -1) { // No selection: disable delete, up, and down buttons. deleteButton.setEnabled(false); upButton.setEnabled(false); downButton.setEnabled(false); nameField.setText(""); } else if (list.getSelectedIndices().length > 1) { // Multiple selection: disable up and down buttons. deleteButton.setEnabled(true); upButton.setEnabled(false); downButton.setEnabled(false); } else { // Single selection: permit all operations. deleteButton.setEnabled(true); upButton.setEnabled(true); downButton.setEnabled(true); nameField.setText(list.getSelectedValue().toString()); } } }
/** 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()); } } }
public AddEditServerForCheckerDialog(MinecraftServer minecraftServer) { super( null, Language.INSTANCE.localize( (minecraftServer == null ? "tools.addserver" : "tools.editserver")), ModalityType.APPLICATION_MODAL); setSize(300, 200); setLocationRelativeTo(null); setLayout(new BorderLayout()); setIconImage(Utils.getImage("/assets/image/Icon.png")); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); setResizable(false); setupComponents(); if (minecraftServer != null) { this.serverEditing = minecraftServer; addEditButton.setText(Language.INSTANCE.localize("common.edit")); serverName.setText(minecraftServer.getName()); serverHost.setText(minecraftServer.getHost()); serverPort.setText(minecraftServer.getPort() + ""); } setVisible(true); }
private void updateDisplay() { if (scale == null) { fileNameField.setText(""); } else { fileNameField.setText(scale.getScaleName()); } }
public void refresh() { refreshPointsPanel(); layerNameTextField.setText(layer.getName()); colorBtn.setBackground(layer.getPath().getAttributes().getOutlineMaterial().getDiffuse()); opacityTextField.setText(layer.getPath().getAttributes().getOutlineOpacity() + ""); sizeTextField.setText(layer.getPath().getAttributes().getOutlineWidth() + ""); }