public Calculate() { super(); rect.setFill(getColor()); tf1 = new TextField(); tf1.setPrefWidth(50.0); AnchorPane.setTopAnchor(tf1, 10.0); AnchorPane.setLeftAnchor(tf1, 80.0); setChangeListener(tf1); cb = new ChoiceBox(FXCollections.observableArrayList("+", "-", "×", "÷", "%")); AnchorPane.setTopAnchor(cb, 10.0); AnchorPane.setLeftAnchor(cb, 135.0); tf2 = new TextField(); tf2.setPrefWidth(50.0); AnchorPane.setTopAnchor(tf2, 10.0); AnchorPane.setLeftAnchor(tf2, 190.0); setChangeListener(tf2); Label wa = new Label("は"); AnchorPane.setTopAnchor(wa, 15.0); AnchorPane.setLeftAnchor(wa, 63.0); getChildren().addAll(wa, tf1, cb, tf2); getChildren().remove(lb); // コネクタを全面に出すために rect.toBack(); makeConnectors(); }
@Override public void start(Stage primaryStage) throws Exception { BorderPane root = new BorderPane(); HBox message = new HBox(); userText = new TextField(); userText.setEditable(false); userText.setOnAction( e -> { sendMessage(e.getEventType().toString()); userText.setText(""); }); message.getChildren().add(userText); message.setAlignment(Pos.CENTER); message.setPadding(new Insets(10)); chatWindow = new TextArea(); chatWindow.setPrefSize(300, 150); chatWindow.setVisible(true); root.setCenter(chatWindow); root.setBottom(message); startRunning(); primaryStage.setTitle("Instant Messenger"); primaryStage.setScene(new Scene(root, 300, 275)); primaryStage.show(); }
private void clear() { Utility.ClearComponents(topPane); Utility.ClearComponents(bottomPane); dateField.setText(Utility.getCurrentDate()); numofChildrenF.setText("0"); }
@FXML private void EstabeleceConexao(ActionEvent event) throws IOException { String ip = txtip.getText(); int port; port = (Integer.parseInt(txtport.getText())); ClienteConexao conexao = new ClienteConexao(ip, port); }
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()); }
public void confirm(ActionEvent event) { String name = nameField.getText(); if (S.isEmpty(name)) { tipsLabel.setText("错误:工具名字不能为空!"); nameField.requestFocus(); return; } String command = commandText.getText(); String order = orderField.getText(); ToolsTray bandeja = (ToolsTray) parentCombo.getSelectionModel().getSelectedItem(); Integer parentId = bandeja.getId(); ToolType toolType = (ToolType) typeCombo.getSelectionModel().getSelectedItem(); String type = toolType.getToolType(); ToolsTray toolsTray = new ToolsTray(); toolsTray.setTrayName(name); toolsTray.setCommand(command); toolsTray.setParentId(parentId); toolsTray.setToolOrder(order); toolsTray.setToolType(type); if (null == id) { dao.insert(toolsTray); id = toolsTray.getId(); tipsLabel.setText("添加成功:" + name); } else { toolsTray.setId(id); dao.update(toolsTray); tipsLabel.setText("更新成功:" + name); } refresh(null); }
/** * 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()); }
@Override public void addFormForDisplayAccount() { gridRowFrom = gridRow; addLabelTextField( gridPane, gridRow, "Account name:", perfectMoneyAccount.getAccountName(), Layout.FIRST_ROW_AND_GROUP_DISTANCE); addLabelTextField( gridPane, ++gridRow, "Payment method:", BSResources.get(perfectMoneyAccount.getPaymentMethod().getId())); addLabelTextField( gridPane, ++gridRow, "Account holder name:", perfectMoneyAccount.getHolderName()); TextField field = addLabelTextField(gridPane, ++gridRow, "Account nr.:", perfectMoneyAccount.getAccountNr()) .second; field.setMouseTransparent(false); addLabelTextField( gridPane, ++gridRow, "Currency:", perfectMoneyAccount.getSingleTradeCurrency().getCodeAndName()); addAllowedPeriod(); }
/** @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); } }
private void clearTabGezinInvoer() { // todo opgave 3 cbOuder1Invoer.getSelectionModel().clearSelection(); cbOuder2Invoer.getSelectionModel().clearSelection(); tfHuwelijkInvoer.clear(); tfScheidingInvoer.clear(); }
private void configureForm(StackPane root) { final Person person = new Person(); person.setName("Sai PradeeP"); VBox layout = new VBox(); layout.setSpacing(15); TextField nameField = new TextField(); nameField.textProperty().bindBidirectional(person.nameProperty()); HBox nameLayout = new HBox(); nameLayout.getChildren().addAll(new Label("Enter the name : "), nameField); HBox displayLayout = new HBox(); final Label lbl = new Label(); displayLayout.getChildren().addAll(new Label("You have entered : "), lbl); Button btn = new Button("Submit"); btn.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { lbl.setText(person.getName()); } }); layout.getChildren().addAll(nameLayout, btn, new Separator(), displayLayout); root.getChildren().addAll(layout); }
@Override public void start(Stage primaryStage) throws Exception { Random rand = new Random(); GridPane layout = new GridPane(); layout.setGridLinesVisible(true); layout.setAlignment(Pos.CENTER); layout.setVgap(2); layout.setHgap(2); layout.setPadding(new Insets(10, 10, 10, 10)); int j = 0; for (int i = 0; i < 11; i++) { int newRandomNum = rand.nextInt((1 - 0) + 1) + 0; TextField number = new TextField(); number.setText(Integer.toString(newRandomNum)); if (i > 9) { if (j > 8) { break; } else { j++; i = 0; } } layout.add(number, j, i); } Scene scene = new Scene(layout, 300, 300); primaryStage.setScene(scene); primaryStage.show(); }
@FXML void salvar(ActionEvent event) { String codigo = txfCodigo.getText(); String nome = txfNome.getText(); System.out.println(codigo + "\t" + nome); }
/** @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 sendRequest(String username, String password) { thisStage = (Stage) logInButton.getScene().getWindow(); Response res = new Request("user/login").set("username", username).set("password", password).send(); if (res.getSuccess()) { Main.setSessionID((String) res.get("sessionID")); System.out.println("Login successful."); Main.userNotLoggedIn.setValue(false); // Save the login option if checked if (keepMeLoggedInCheckBox.isSelected()) { pc.setProp("username", usernameTextField.getText()); pc.setProp("password", passwordPasswordField.getText()); pc.setProp("signInCheckbox", "true"); pc.saveProps(); } HomeController.userName = usernameTextField.getText(); thisStage.close(); } else { // incorrect password } }
public void userInputScreen() { // Scene 1 elements Label label1 = new Label("Please enter your name and age"); TextField nameInput = new TextField(); TextField ageInput = new TextField(); nameInput.setPromptText("ENTER YOUR NAME HERE"); ageInput.setPromptText("ENTER YOUR AGE HERE"); Button buttonNext = new Button("Next"); buttonNext.setOnAction(e -> validateName(nameInput, ageInput)); buttonNext.setOnKeyPressed( event -> { System.out.println(event.getCode()); validateName(nameInput, ageInput); }); // Scene 1 layout VBox layout1 = new VBox(20); layout1.getChildren().addAll(label1, nameInput, ageInput, buttonNext); layout1.setAlignment(Pos.CENTER); scene1 = new Scene(layout1, 1000, 800); window1.setScene(scene1); window1.setTitle("Memory test"); window1.show(); }
@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"); }
@FXML public void initialize(URL location, ResourceBundle resources) { for (String s : Main.settings.getSkins()) { skin.getItems().add(s); } skin.setValue(Main.settings.getSkin()); skin.setOnAction( event -> { Main.settings.setSkin(skin.getSelectionModel().getSelectedItem()); save(); }); for (String list : Main.settings.getLists().keySet()) { TextField k = new TextField(list); k.setId(list); String listName = Main.settings.getLists().get(list); TextField v = new TextField(listName); v.setId("V" + list); Button deleteButton = new Button(); deleteButton.setText("Delete"); addListListener(k, v, deleteButton); lists.getChildren().add(k); listsName.getChildren().add(v); deleteButtons.getChildren().add(deleteButton); } }
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()); }
public void storeEntry() { Stage window = new Stage(); Button button; Label label = new Label("Please enter the item UPC"); Label label2 = new Label("Please enter the item's location"); window.initModality(Modality.APPLICATION_MODAL); window.setTitle("Save an item"); window.setWidth(300); window.setHeight(400); final TextField upcInput = new TextField(); final TextField locationInput = new TextField(); button = new Button("Save"); button.setOnAction( e -> { try { itemUPC = Double.parseDouble(upcInput.getText()); itemLOC = locationInput.getText(); } catch (Exception f) { displaySimple("Bad input", "Please enter valid inputs"); status = false; } window.close(); }); VBox layout = new VBox(20); layout.getChildren().addAll(label, upcInput, label2, locationInput, button); layout.setAlignment(Pos.CENTER); Scene scene = new Scene(layout); window.setScene(scene); window.showAndWait(); }
private TextField buildField(String text, double maxWidth) { TextField tf = new TextField(text); tf.setEditable(false); tf.setMinWidth(maxWidth); tf.setMaxWidth(maxWidth); return tf; }
public void customerEntry() { Stage window = new Stage(); Button button; Label label = new Label("Please enter the item you are searching for"); window.initModality(Modality.APPLICATION_MODAL); window.setTitle("Find an item"); window.setWidth(400); window.setHeight(400); final TextField nameInput = new TextField(); button = new Button("Find"); button.setOnAction( e -> { try { userEntry = nameInput.getText(); } catch (Exception f) { displaySimple("Bad input", "Please enter valid inputs"); status = false; } window.close(); }); VBox layout = new VBox(20); layout.getChildren().addAll(label, nameInput, button); layout.setAlignment(Pos.CENTER); Scene scene = new Scene(layout); window.setScene(scene); window.showAndWait(); }
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); }
public void storeLogin() { Stage window = new Stage(); Button button; String password = "******"; Label label = new Label("Please enter the store password"); window.initModality(Modality.APPLICATION_MODAL); window.setTitle("Store Login"); window.setWidth(300); window.setHeight(200); final TextField passWordInput = new TextField(); button = new Button("Enter"); button.setOnAction( e -> { String entry = passWordInput.getText(); if (entry.equalsIgnoreCase(password)) { answer = true; window.close(); } else { answer = false; window.close(); } }); VBox layout = new VBox(20); layout.getChildren().addAll(label, passWordInput, button); layout.setAlignment(Pos.CENTER); Scene scene = new Scene(layout); window.setScene(scene); window.showAndWait(); }
@FXML private void calcular() { try { if (interprete.checarParentesis(txtFuncion.getText())) { interprete.setFuncion(txtFuncion.getText()); if (truncamiento.isSelected()) { interprete.setTipoValores(1); } else { interprete.setTipoValores(2); } getK(); txtResultado.setText( interprete.getFlotante(new BigDecimal(interprete.getResultado())) + ""); setOperaciones(); } else { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Información"); alert.setContentText( "Error de sintaxis. Verifique que haya escrito la función correctamente"); alert.showAndWait(); } } catch (Exception e) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Información"); alert.setContentText( "Error de sintaxis. Verifique que haya escrito la función correctamente"); alert.showAndWait(); } }
private void createTextField() { textField = new TextField(getString()); textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2); textField.setOnKeyPressed( new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent t) { if (t.getCode() == KeyCode.ENTER) { commitEdit(textField.getText()); } else if (t.getCode() == KeyCode.ESCAPE) { cancelEdit(); } else if (t.getCode() == KeyCode.TAB) { commitEdit(textField.getText()); TableColumn nextColumn = getNextColumn(!t.isShiftDown()); if (nextColumn != null) { getTableView().edit(getTableRow().getIndex(), nextColumn); } } } }); textField .focusedProperty() .addListener( new ChangeListener<Boolean>() { @Override public void changed( ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (!newValue && textField != null) { commitEdit(textField.getText()); } } }); }
private boolean handleSitLeave( boolean bSit, int iPlayerPosition, Label lblPlayer, TextField txtPlayer, ToggleButton btnSitLeave, HBox HBoxPlayerCards) { if (bSit == false) { Player p = new Player(txtPlayer.getText(), iPlayerPosition); mainApp.AddPlayerToTable(p); lblPlayer.setText(txtPlayer.getText()); lblPlayer.setVisible(true); btnSitLeave.setText("Leave"); txtPlayer.setVisible(false); bSit = true; } else { mainApp.RemovePlayerFromTable(iPlayerPosition); btnSitLeave.setText("Sit"); txtPlayer.setVisible(true); lblPlayer.setVisible(false); HBoxPlayerCards.getChildren().clear(); bSit = false; } return bSit; }
@FXML private void onOkButtonClicked() { if (!headerTextField.getText().isEmpty() || picturePreview.getImage() != null) { HTMLHeader header; if (!headerTextField.getText().isEmpty() && picturePreview.getImage() == null) { header = new HTMLHeader(headerTextField.getText()); System.out.println("Header only has text."); } else if (headerTextField.getText().isEmpty() && picturePreview.getImage() != null) { header = new HTMLHeader(picturePreview.getImage()); System.out.println("Header only has image."); } else { header = new HTMLHeader(headerTextField.getText(), picturePreview.getImage()); System.out.println("Header has both image and text."); } ApplicationManager.getInstance().setWebPageHeader(header); System.out.println("Attempting to set header to webpage."); // --------------------Added By James------------------------------------------------ // JavaToHTML HTML = new JavaToHTML(); // ApplicationManager.getInstance().getHtmlGenerator().setHeaderFromGUI(headerTextField.getText(),picturePath.getText()); // writeAndRefresh(); // --------------------End Added By James------------------------------------------------ } else { System.out.println("Header has nothing. Not creating an object."); } Stage stage = (Stage) okButton.getScene().getWindow(); stage.close(); }
@Override public void setFields(Shopping shopping) { this.shopping = shopping; priceField.setText(Double.toString(shopping.getPrice())); quantityField.setText(Integer.toString(shopping.getQuantity())); }
@Override public Status getStatus() { Status status = new Status(); status.put("id", this.getUUID()); if (variable != null) { status.put("variable", variable.getStatus()); } if (leftVariable != null) { status.put("left", leftVariable.getStatus()); } else if (arg1 != null) { status.put("left", arg1.getStatus()); } else { status.put("left", tf1.getText()); } status.put("op", cb.getValue()); if (arg2 != null) { status.put("right", arg2.getStatus()); } else { status.put("right", tf2.getText()); } return status; }