public void operationButtonClicked(ActionEvent e) { String operation; operation = ((Button) e.getSource()).getText(); if (!operation.equals("=")) { if (!operator.isEmpty() && text.getText().split(" ").length < 2) { number = Double.parseDouble(text.getText().split(" ")[0]); text.setText(number + " " + operator + " "); } if (!operator.isEmpty() && text.getText().split(" ").length > 2) { double result = model.calculate(number, Double.parseDouble(text.getText().split(" ")[2]), operator); text.setText(String.valueOf(result)); } operator = operation; number = Double.parseDouble(text.getText().split(" ")[0]); text.setText(number + " " + operator + " "); } else { if (operator.isEmpty()) return; System.out.println(text.getText().split(" ")[2]); double result = model.calculate(number, Double.parseDouble(text.getText().split(" ")[2]), operator); text.setText(String.valueOf(result)); start = true; number = result; operator = ""; } }
private VBox createStatePane() { VBox stateBox = new VBox(); stateBox.setSpacing(10); stateBox.setPadding(new Insets(10, 20, 0, 0)); stateBox.setAlignment(Pos.TOP_CENTER); Label levelLabel = new Label("level"); Label lineLabel = new Label("line"); Label scoreLabel = new Label("score"); levelField.setMaxWidth(120); lineField.setMaxWidth(120); scoreField.setMaxWidth(120); levelField.setEditable(false); lineField.setEditable(false); scoreField.setEditable(false); levelField.setText(level + ""); lineField.setText(numberOfLines + ""); scoreField.setText(score + ""); VBox.setMargin(nextGrid, new Insets(0, 0, 80, 0)); stateBox .getChildren() .addAll(nextGrid, levelLabel, levelField, lineLabel, lineField, scoreLabel, scoreField); return stateBox; }
private void eliminar() { if (comboListar.getSelectionModel().getSelectedIndex() == 0) { eliminar( 5, listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(), 6); txtfNombre.setText(null); } if (comboListar.getSelectionModel().getSelectedIndex() == 1) { eliminar( 6, listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(), 7); txtfNombre.setText(null); } if (comboListar.getSelectionModel().getSelectedIndex() == 2) { eliminar( 7, listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(), 8); txtfNombre.setText(null); } if (comboListar.getSelectionModel().getSelectedIndex() == 3) { eliminar( 8, listaDatos.get(tablaResultados.getSelectionModel().getSelectedIndex()).getIdAutor(), 5); txtfNombre.setText(null); } }
@Override public void setFields(Shopping shopping) { this.shopping = shopping; priceField.setText(Double.toString(shopping.getPrice())); quantityField.setText(Integer.toString(shopping.getQuantity())); }
@FXML private void handleLoadAction(ActionEvent event) { try { RandomAccessFile input = new RandomAccessFile("product.txt", "r"); String line; for (int i = 0; ; i++) { line = input.readLine(); if (line == null) break; int id = Integer.parseInt(line); line = input.readLine(); String name = line; line = input.readLine(); String category = line; line = input.readLine(); double price = Double.parseDouble(line); Product p = new Product(id, name, category, price); products[i] = p; } productIDField.setText(products[0].getId() + ""); productNameField.setText(products[0].getName()); productCategoryField.setText(products[0].getCategory()); unitPriceField.setText(products[0].getPrice() + ""); } catch (FileNotFoundException ex) { Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); } }
@FXML private void handleNewAction(ActionEvent event) { productIDField.setText(""); productNameField.setText(""); productCategoryField.setText(""); unitPriceField.setText(""); }
@FXML private void handleSaveAction(ActionEvent event) { int id = Integer.parseInt(productIDField.getText()); String name = productNameField.getText(); String category = productCategoryField.getText(); double price = Double.parseDouble(unitPriceField.getText()); Product p = new Product(id, name, category, price); try { RandomAccessFile output = new RandomAccessFile("product.txt", "rw"); output.seek(output.length()); output.writeBytes(p.getId() + "\n"); output.writeBytes(p.getName() + "\n"); output.writeBytes(p.getCategory() + "\n"); output.writeBytes(p.getPrice() + "\n"); productIDField.setText(""); productNameField.setText(""); productCategoryField.setText(""); unitPriceField.setText(""); } catch (FileNotFoundException ex) { Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); } }
/** * Set lower and upper limits for an ordinate * * @param axis Axis to configure */ void setOrdinateRange(final NumberAxis axis) { axis.setAutoRange(false); GridPane grid = new GridPane(); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(0, 10, 0, 10)); final TextField tfMax; final TextField tfMin; final TextField tfTick; final TextField tfFuente; grid.add(new Label("Axis"), 0, 0); grid.add(new Label(axis.getLabel()), 1, 0); grid.add(new Label("Lower"), 0, 1); grid.add(tfMin = new TextField(), 1, 1); grid.add(new Label("Upper"), 0, 2); grid.add(tfMax = new TextField(), 1, 2); grid.add(new Label("Space"), 0, 3); grid.add(tfTick = new TextField(), 1, 3); tfMin.setText(String.valueOf(axis.getLowerBound())); tfMax.setText(String.valueOf(axis.getUpperBound())); tfTick.setText(String.valueOf(axis.getTickUnit().getSize())); new PseudoModalDialog(skeleton, grid, true) { @Override public boolean validation() { axis.setLowerBound(Double.valueOf(tfMin.getText())); axis.setUpperBound(Double.valueOf(tfMax.getText())); axis.setTickUnit(new NumberTickUnit(Double.valueOf(tfTick.getText()))); return true; } }.show(); }
private void updateUI() { final boolean running = model.isRunning(); final boolean scriptRunning = model.isScriptRunning(); startButton.setDisable(running || scriptRunning); stopButton.setDisable(!running && !scriptRunning); scriptsButton.setDisable(running || scriptRunning); final Settings settings = model.loadSettings(); goldField.setText(settings.getGoldThreshold() + ""); elixirField.setText(settings.getElixirThreshold() + ""); deField.setText(settings.getDarkElixirThreshold() + ""); maxThField.setText(settings.getMaxThThreshold() + ""); detectEmptyCollectorsCheckBox.setSelected(settings.isDetectEmptyCollectors()); isMatchAllConditionsCheckBox.setSelected(settings.isMatchAllConditions()); collectResourcesCheckBox.setSelected(settings.isCollectResources()); trainTroopsSlider.setValue(settings.getTrainMaxTroops()); logLevelComboBox.getSelectionModel().select(settings.getLogLevel()); autoAttackComboBox.getSelectionModel().select(settings.getAttackStrategy()); rax1ComboBox.getSelectionModel().select(settings.getRaxInfo()[0]); rax2ComboBox.getSelectionModel().select(settings.getRaxInfo()[1]); rax3ComboBox.getSelectionModel().select(settings.getRaxInfo()[2]); rax4ComboBox.getSelectionModel().select(settings.getRaxInfo()[3]); rax5ComboBox.getSelectionModel().select(settings.getRaxInfo()[4]); rax6ComboBox.getSelectionModel().select(settings.getRaxInfo()[5]); extraFuncCheckBox.setSelected(settings.isExtraFunctions()); }
@FXML private void setStereoMode() { StereoMode mode = stereoMode.getSelectionModel().getSelectedItem(); if (mode == StereoMode.FAKE_STEREO) { util.getConfig().getEmulationSection().setForceStereoTune(true); util.getConfig().getEmulationSection().setForce3SIDTune(false); util.getConfig().getEmulationSection().setDualSidBase(0xd400); baseAddress.setText("0xd400"); } else if (mode == StereoMode.THREE_SID) { util.getConfig().getEmulationSection().setForceStereoTune(true); util.getConfig().getEmulationSection().setForce3SIDTune(true); util.getConfig().getEmulationSection().setDualSidBase(0xd420); util.getConfig().getEmulationSection().setThirdSIDBase(0xd440); baseAddress.setText("0xd420"); thirdAddress.setText("0xd440"); } else if (mode == StereoMode.STEREO) { util.getConfig().getEmulationSection().setForceStereoTune(true); util.getConfig().getEmulationSection().setForce3SIDTune(false); util.getConfig().getEmulationSection().setDualSidBase(0xd420); baseAddress.setText("0xd420"); } else { util.getConfig().getEmulationSection().setForceStereoTune(false); util.getConfig().getEmulationSection().setForce3SIDTune(false); } enableStereoSettings(util.getPlayer().getTune()); // stereo mode change: plugIn required SID chips updateSIDChipConfiguration(); // stereo mode changes has an impact on all filter curves drawFilterCurve(mainFilter, mainFilterCurve); drawFilterCurve(secondFilter, secondFilterCurve); drawFilterCurve(thirdFilter, thirdFilterCurve); }
/** Method to read the properties and adding them to the pane */ private void readProperties() { ProfileProperties profile = PropertiesUtils.getProfile(); // Musiclibrary properties musicLibraryPath.setText(profile.getPathToMusicLibrary()); OrderingProperty orderIngProperty = profile.getOrderingMode(); if (orderIngProperty == OrderingProperty.GAA) { orderingMode.setValue(GAA); } else if (orderIngProperty == OrderingProperty.AA) { orderingMode.setValue(AA); } else { orderingMode.setValue(AAA); } if (profile.getPlayListHeader().contains("german")) { playListHeaderMode.setValue(germanHeader); } else { playListHeaderMode.setValue(englishHeader); } // Import properties keepFiles.setSelected(profile.isKeepOriginalFiles()); justTagFiles.setSelected(profile.isJustTagFiles()); // Playlist properties playListExport.setSelected(profile.isPlayListExport()); playListExportPath.setText(profile.getPlayListExportDir()); }
/** @param fp */ private void addItems(FlowPane fp) { for (StaffInfo staff : StaffWagesPersistence.wagesItems) { FlowPane horizontalPane = new FlowPane(Orientation.HORIZONTAL); horizontalPane.setHgap(30); horizontalPane.setAlignment(Pos.CENTER); final StaffInfo s = (StaffInfo) staff; // Items FLD ----------------------------------------------------------- TextField itemName = new TextField(); itemName.setMaxWidth(70); itemName.setText(s.staffName); itemName.setEditable(false); itemName.setPromptText("Item Name"); horizontalPane.getChildren().add(itemName); TextField itemPrice = new TextField(); itemPrice.setMaxWidth(70); itemPrice.setText(s.staffWages); itemPrice.setEditable(false); itemPrice.setPromptText("Price PKR"); horizontalPane.getChildren().add(itemPrice); Button saveButt = new Button("Delete"); horizontalPane.getChildren().add(saveButt); saveButt.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { StaffWagesPersistence.deleteStaff(s.staffName); primaryStage.close(); new StaffWagesDialog(); } }); fp.getChildren().add(horizontalPane); } }
public void newOrder(ActionEvent actionEvent) { Order.resetOrder(); numberOfOrders = 0; myOrders = new ArrayList<>(); processBtn.setDisable(false); confirmBtn.setDisable(true); viewBtn.setDisable(true); finishBtn.setDisable(true); orderBox.setDisable(false); orderBox.setText(""); IDBox.setText(""); quantityBox.setText(""); infoBox.setText(""); subtotalBox.setText(""); IDLabel.setText("Enter Book ID for Item #" + (myOrders.size() + 1) + ":"); quantityLabel.setText("Enter quantity for Item #" + (myOrders.size() + 1) + ":"); infoLabel.setText(String.format("Item #%d info", myOrders.size() + 1)); processBtn.setText(String.format("Process Item #%d", myOrders.size() + 1)); confirmBtn.setText(String.format("Confirm Item #%d", myOrders.size() + 1)); subtotalLabel.setText("Order subtotal for " + myOrders.size() + " items:"); }
public void setScore(Score score) { ScoreInfo info = score.getInfo(); lblTitle.setText(info.getTitle()); txtWorkNumber.setText(info.getWorkNumber()); txtWorkTitle.setText(info.getWorkTitle()); txtMovementNumber.setText(info.getMovementNumber()); txtMovementTitle.setText(info.getMovementTitle()); // creators String s = "-"; if (info.getCreators().size() > 0) { s = ""; for (Creator creator : info.getCreators()) s += (creator.getType() != null ? creator.getType() + ": " : "") + creator.getName() + "\n"; } txtCreators.setText(s); // rights s = "-"; if (info.getRights().size() > 0) { s = ""; for (Rights rights : info.getRights()) s += (rights.getType() != null ? rights.getType() + ": " : "") + rights.getText() + "\n"; } txtRights.setText(s); // parts s = "-"; if (score.getStavesList().getParts().size() > 0) { s = ""; for (int i : range(score.getStavesList().getParts())) { Part part = score.getStavesList().getParts().get(i); s += i + ": " + part.getName() + "\n"; } } txtParts.setText(s); }
/** @param fp */ private void addItems(FlowPane fp) { for (CafeItemsInfo cafeItem : CafePricingPersistence.cafeItems) { FlowPane horizontalPane = new FlowPane(Orientation.HORIZONTAL); horizontalPane.setHgap(30); horizontalPane.setAlignment(Pos.CENTER); final CafeItemsInfo c = (CafeItemsInfo) cafeItem; // Items FLD ----------------------------------------------------------- TextField itemName = new TextField(); itemName.setMaxWidth(70); itemName.setText(c.itemName); itemName.setEditable(false); itemName.setPromptText("Item Name"); horizontalPane.getChildren().add(itemName); TextField itemPrice = new TextField(); itemPrice.setMaxWidth(70); itemPrice.setText(c.itemPrice + " Rs"); itemPrice.setEditable(false); itemPrice.setPromptText("Price PKR"); horizontalPane.getChildren().add(itemPrice); Button saveButt = new Button("Delete"); horizontalPane.getChildren().add(saveButt); saveButt.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { CafePricingPersistence.deleteCafeItems(c.itemName); primaryStage.close(); new CafePricingDialog(); } }); fp.getChildren().add(horizontalPane); } }
/** * shows the options to edit the selected shape * * @param selectedShape the shape currently selected */ public void shapeSelected(ReactiveShape selectedShape) { shape = selectedShape; switch (shape.getShapeType()) { case ReactiveShape.RECTANGLE: type.setValue(TYPE_RECTANGLE); break; case ReactiveShape.CIRCLE: type.setValue(TYPE_CIRCLE); break; case ReactiveShape.TRIANGLE: type.setValue(TYPE_TRIANGLE); break; } backgroundPane.setVisible(false); shapePane.setVisible(true); color.setValue(shape.getColor()); filled.setSelected(shape.isFilled()); borderThickness.setText("" + shape.getBorderThickness()); borderColor.setValue(shape.getBorderColor()); width.setText("" + (int) shape.getWidth()); height.setText("" + (int) shape.getHeight()); }
public void setupBindings() { populateProdFreqValues(); populateProdTypeValues(); populateBillCategoryValues(); refreshProdSpecialPriceTable(); checkItems(); dowTF .getItems() .addAll("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"); nameTF.setText(productRow.getName()); typeTF.getSelectionModel().select(productRow.getType()); priceTF.setText("" + productRow.getPrice()); mondayTF.setText("" + productRow.getMonday()); tuesdayTF.setText("" + productRow.getTuesday()); wednesdayTF.setText("" + productRow.getWednesday()); thursdayTF.setText("" + productRow.getThursday()); fridayTF.setText("" + productRow.getFriday()); saturdayTF.setText("" + productRow.getSaturday()); sundayTF.setText("" + productRow.getSunday()); codeTF.setText(productRow.getCode()); dowTF.getSelectionModel().select(productRow.getDow()); firstDeliveryDate.setValue(productRow.getFirstDeliveryDate()); issueDate.setValue(productRow.getIssueDate()); billCategoryTF.getSelectionModel().select(productRow.getBillCategory()); }
@Override public void initialize(URL url, ResourceBundle rb) { // Inicializamos el rango sobre el que pintaremos la funcion. rangoMin.setText("-10"); rangoMax.setText("10"); choiceFun.setValue("x"); }
private void clear() { Utility.ClearComponents(topPane); Utility.ClearComponents(bottomPane); dateField.setText(Utility.getCurrentDate()); numofChildrenF.setText("0"); }
public void confirmItem(ActionEvent actionEvent) { orderBox.setDisable(true); subtotalLabel.setText("Order subtotal for " + myOrders.size() + " items:"); subtotalBox.setText(String.valueOf(Order.getRunningTotal())); if (myOrders.size() < numberOfOrders) { IDLabel.setText("Enter Book ID for Item #" + (myOrders.size() + 1) + ":"); quantityLabel.setText("Enter quantity for Item #" + (myOrders.size() + 1) + ":"); infoLabel.setText(String.format("Item #%d info", myOrders.size() + 1)); processBtn.setText(String.format("Process Item #%d", myOrders.size() + 1)); confirmBtn.setText(String.format("Confirm Item #%d", myOrders.size() + 1)); processBtn.setDisable(false); } IDBox.setText(""); quantityBox.setText(""); confirmBtn.setDisable(true); viewBtn.setDisable(false); finishBtn.setDisable(false); Alert alert = new Alert( Alert.AlertType.INFORMATION, "Item #" + (myOrders.size()) + " accepted", ButtonType.YES); alert.show(); }
/** * Initializes the controller class. * * @param url * @param rb */ @Override public void initialize(URL url, ResourceBundle rb) { setupTable(); inflateTable(); atracaoTableView.setRowFactory( (TableView<Atracao> atracaoTablewView) -> { final TableRow<Atracao> row = new TableRow<>(); row.addEventFilter( MouseEvent.MOUSE_PRESSED, (MouseEvent event) -> { final int index = row.getIndex(); this.currentSelectedRow = index; if (index >= 0 && index < atracaoTablewView.getItems().size()) { atracaoTableView.getSelectionModel().select(index); textField1.setText(atracaoTableView.getItems().get(index).getIdAtracao()); textArea2.setText(atracaoTableView.getItems().get(index).getDescricao()); textField3.setText( atracaoTableView.getItems().get(index).getClassificacaoEtaria()); textField4.setText(atracaoTableView.getItems().get(index).getLocal()); textField5.setText(atracaoTableView.getItems().get(index).getEvento()); textField6.setText(atracaoTableView.getItems().get(index).getData()); event.consume(); } }); return row; }); }
@FXML private void handleNextAction(ActionEvent event) { int pr_id = Integer.parseInt(productIDField.getText()); String pr_name = productNameField.getText(); String pr_category = productCategoryField.getText(); double pr_unit_price = Double.parseDouble(unitPriceField.getText()); Product pr_product = new Product(pr_id, pr_name, pr_category, pr_unit_price); if (pr_product != null) { try { RandomAccessFile input = new RandomAccessFile("product.txt", "r"); String line; for (int i = 0; ; i++) { line = input.readLine(); // if (line == null) // break; int id = Integer.parseInt(line); line = input.readLine(); String name = line; line = input.readLine(); String category = line; line = input.readLine(); double price = Double.parseDouble(line); Product p = new Product(id, name, category, price); products[i] = p; if (products[i].getId() == pr_product.getId() && i < products.length) { line = input.readLine(); int next_id = Integer.parseInt(line); line = input.readLine(); String next_name = line; line = input.readLine(); String next_category = line; line = input.readLine(); double next_unit_price = Double.parseDouble(line); Product next_product = new Product(next_id, next_name, next_category, next_unit_price); products[i + 1] = next_product; productIDField.setText(products[i + 1].getId() + ""); productNameField.setText(products[i + 1].getName()); productCategoryField.setText(products[i + 1].getCategory()); unitPriceField.setText(products[i + 1].getPrice() + ""); break; } // else if(products[0] == pr_product){ // productIDField.setText(products[0].getId() + ""); // productNameField.setText(products[0].getName()); // productCategoryField.setText(products[0].getCategory()); // unitPriceField.setText(products[0].getPrice() + ""); // break; // } } } catch (FileNotFoundException ex) { Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(FXMLDocumentController.class.getName()).log(Level.SEVERE, null, ex); } } }
public void reset(ActionEvent event) { id = null; nameField.setText(""); orderField.setText(""); pathField.setText(""); commandText.setText(""); refresh(null); }
public void Limpiar() { txtCarrera.setText(""); txtMatricula.setText(""); txtJefe.setText(""); txtSiglas.setText(""); cboAcreditada.getSelectionModel().selectFirst(); carreraModificada = null; }
@Override void toggleControls(boolean visible) { tfKey.setVisible(visible); tfValue.setVisible(visible); tfKey.setText(""); tfValue.setText(""); }
private synchronized void checkAccount(Account account) { if (account != null) { textFieldFirstname.setText(account.getFirstName()); textFieldLastname.setText(account.getLastName()); textFieldUser.setText(account.getUsername()); passwordField.setText(account.getPassword()); if (account.getRfidKey() != null) textFieldRfid.setText(account.getRfidKey().getId()); } }
private void getuserinfo(String name) throws IOException { ToServer.writeUTF("iserinfo"); ToServer.writeUTF(name); txaddname.setText(FromServer.readUTF()); txaddpass.setText(FromServer.readUTF()); txgroupname.setText(FromServer.readUTF()); if (FromServer.readUTF().equals("1")) cboxadmin.setSelected(true); else cboxadmin.setSelected(false); }
/** * Sets the record to be edited in the dialog. * * @param order */ public void setOrder(Order order) { this.order = order; timeOrderField.setText(order.getTime()); employeeOrderField.setText(order.getEmployee()); clientOrderField.setText(order.getClient()); priceOrderField.setText(order.getPrice()); paidOrderCheckBox.setSelected(order.isPaid()); }
@FXML private void changeToJIRADefectCount(Event event) { checkLegacyDTS.setSelected(false); checkJIRA.setSelected(true); checkOther.setSelected(false); textPrefix.setDisable(true); textPrefix.setText("ECOA-"); textMax.setText("ECOA-99999"); }
// something wrong public void changeValue() { if (operator.equals("+")) { number = Integer.valueOf(text.getText()); text.setText("-" + number); operator = "-"; } else number = Integer.valueOf(text.getText()); text.setText("+" + number); operator = "+"; }