List of usage examples for javafx.scene.control Button Button
public Button(String text)
From source file:dsfixgui.view.DSFGraphicsPane.java
private void initialize() { //Basic layout this.setFitToWidth(true); spacerColumn = new ColumnConstraints(); spacerColumn.setFillWidth(true);//from w ww.jav a 2 s . c o m spacerColumn.setPercentWidth(3.0); primaryColumn = new ColumnConstraints(); primaryColumn.setFillWidth(true); primaryColumn.setPercentWidth(95.0); primaryPane = new GridPane(); primaryPane.getColumnConstraints().addAll(spacerColumn, primaryColumn); primaryVBox = new VBox(); primaryVBox.getStyleClass().add("spacing_15"); primaryPane.add(primaryVBox, 1, 0); titleLabel = new Label(GRAPHICS.toUpperCase() + " " + SETTINGS.toUpperCase()); titleLabel.getStyleClass().add("settings_title"); titleBar = new HBox(); titleBar.setAlignment(Pos.CENTER); titleBar.getChildren().add(titleLabel); restoreDefaultsBar = new HBox(); restoreDefaultsBar.setAlignment(Pos.CENTER); restoreDefaultsBar.setSpacing(5.0); applySettingsButton = new Button(APPLY_SETTINGS); restoreDefaultsButton = new Button(RESTORE_DEFAULTS); applySettingsButton.getStyleClass().add("translate_y_4"); restoreDefaultsButton.getStyleClass().add("translate_y_4"); restoreDefaultsBar.getChildren().addAll(applySettingsButton, restoreDefaultsButton); spacerHBox = new HBox(); spacerHBox.setMinHeight(10.0); bottomSpacerHBox = new HBox(); bottomSpacerHBox.setMinHeight(10.0); /////////////////////SETTINGS PANES///////////////////// // // // //MAIN GRAPHICS OPTIONS // //Render resolution renderResPane = new FlowPane(); renderResPane.getStyleClass().add("settings_pane"); renderResLabel = new Label(RENDER_RES_LABEL + " "); renderResLabel.getStyleClass().addAll("bold_text", "font_12_pt"); renderResLabel.setTooltip(new Tooltip(RENDER_RES_TT)); renderWidthLabel = new Label(WIDTH_HEIGHT[0] + ":"); renderWidthField = new TextField(""); renderWidthField.appendText("" + config.getRenderWidth()); renderWidthField.getStyleClass().add("settings_text_field"); renderHeightLabel = new Label(" " + WIDTH_HEIGHT[1] + ":"); renderHeightField = new TextField(""); renderHeightField.appendText("" + config.getRenderHeight()); renderHeightField.getStyleClass().add("settings_text_field"); setWindowsRenderRes = new Button(USE_WINDOWS_RES); renderResPane.getChildren().addAll(renderResLabel, renderWidthLabel, renderWidthField, renderHeightLabel, renderHeightField, setWindowsRenderRes); // //Present Resolution presentResPane = new FlowPane(); presentResPane.getStyleClass().add("settings_pane"); presentResLabel = new Label(PRESENT_RES_LABEL + " "); presentResLabel.getStyleClass().addAll("bold_text", "font_12_pt"); presentResLabel.setTooltip(new Tooltip(PRESENT_RES_TT)); presentResSpacer = new HBox(); presentResSpacer.setMinWidth(3); presentWidthLabel = new Label(WIDTH_HEIGHT[0] + ":"); presentWidthField = new TextField(""); presentWidthField.appendText(config.getPresentWidth() + ""); presentRes[0] = config.getPresentWidth() + ""; presentWidthField.getStyleClass().add("settings_text_field"); presentHeightLabel = new Label(" " + WIDTH_HEIGHT[1] + ":"); presentHeightField = new TextField(""); presentHeightField.appendText(config.getPresentHeight() + ""); presentRes[1] = config.getPresentHeight() + ""; presentHeightField.getStyleClass().add("settings_text_field"); setWindowsPresentRes = new Button(USE_WINDOWS_RES); presentResSpacer2 = new HBox(); presentResSpacer2.setMinWidth(5); presentResChoice = new ToggleGroup(); usePresentRes = new RadioButton(USE_PRESENT_RES + " "); usePresentRes.setToggleGroup(presentResChoice); dontUsePresentRes = new RadioButton(DONT_USE_PRES_RES); dontUsePresentRes.setToggleGroup(presentResChoice); //Check if presentRes is off if (config.getPresentWidth() == 0 && config.getPresentHeight() == 0) { presentWidthField.setDisable(true); presentHeightField.setDisable(true); setWindowsPresentRes.setDisable(true); dontUsePresentRes.setSelected(true); } else { presentWidthField.setDisable(false); presentWidthField.setText("" + config.getPresentWidth()); presentHeightField.setDisable(false); presentHeightField.setText("" + config.getPresentHeight()); setWindowsPresentRes.setDisable(false); usePresentRes.setSelected(true); recheckTextInput(presentWidthField); recheckTextInput(presentHeightField); } presentResPane.getChildren().addAll(presentResLabel, presentResSpacer, presentWidthLabel, presentWidthField, presentHeightLabel, presentHeightField, setWindowsPresentRes, presentResSpacer2, usePresentRes, dontUsePresentRes); // // // //ANTIALIASING OPTIONS // //AA Quality aaQualityPane = new FlowPane(); aaQualityPane.getStyleClass().add("settings_pane"); aaQualityLabel = new Label(AA_QUALITY_LABEL + " "); aaQualityLabel.getStyleClass().addAll("bold_text", "font_12_pt"); aaQualityLabel.setTooltip(new Tooltip(AA_QUALITY_TT)); aaQualityPicker = new ComboBox(FXCollections.observableArrayList(AAQUALITIES)); aaQualityPicker.setValue(AAQUALITIES[config.aaQuality.get()]); aaQualityPane.getChildren().addAll(aaQualityLabel, aaQualityPicker); // //AA Type aaTypePane = new FlowPane(); aaTypePane.getStyleClass().add("settings_pane"); aaTypeLabel = new Label(AA_TYPE_LABEL + " "); aaTypeLabel.getStyleClass().addAll("bold_text", "font_12_pt"); aaTypeLabel.setTooltip(new Tooltip(AA_TYPE_TT)); aaTypePicker = new ComboBox(FXCollections.observableArrayList(AATYPES)); aaTypePicker.setValue(config.aaType.toString()); if (config.aaQuality.get() == 0) { aaTypePicker.setDisable(true); } aaTypePane.getChildren().addAll(aaTypeLabel, aaTypePicker); // // // //AMBIENT OCCLUSION OPTIONS // //SSAO Strength ssaoStrengthPane = new FlowPane(); ssaoStrengthPane.getStyleClass().add("settings_pane"); ssaoStrengthLabel = new Label(SSAO_STRENGTH_LABEL + " "); ssaoStrengthLabel.getStyleClass().addAll("bold_text", "font_12_pt"); ssaoStrengthLabel.setTooltip(new Tooltip(SSAO_STRENGTH_TT)); ssaoStrengthPicker = new ComboBox(FXCollections.observableArrayList(SSAOSTRENGTHS)); ssaoStrengthPicker.setValue(SSAOSTRENGTHS[config.ssaoStrength.get()]); ssaoStrengthPane.getChildren().addAll(ssaoStrengthLabel, ssaoStrengthPicker); // //SSAO Scale ssaoScalePane = new FlowPane(); ssaoScalePane.getStyleClass().add("settings_pane"); ssaoScaleLabel = new Label(SSAO_SCALE_LABEL + " "); ssaoScaleLabel.getStyleClass().addAll("bold_text", "font_12_pt"); ssaoScaleLabel.setTooltip(new Tooltip(SSAO_SCALE_TT)); ssaoScalePicker = new ComboBox(FXCollections.observableArrayList(SSAOSCALES)); ssaoScalePicker.setValue(SSAOSCALES[config.ssaoScale.get() - 1]); if (config.ssaoStrength.get() == 0) { ssaoScalePicker.setDisable(true); } ssaoScalePane.getChildren().addAll(ssaoScaleLabel, ssaoScalePicker); // //SSAO Type ssaoTypePane = new FlowPane(); ssaoTypePane.getStyleClass().add("settings_pane"); ssaoTypeLabel = new Label(SSAO_TYPE_LABEL + " "); ssaoTypeLabel.setTooltip(new Tooltip(SSAO_TYPE_TT)); ssaoTypeLabel.getStyleClass().addAll("bold_text", "font_12_pt"); ssaoTypePicker = new ComboBox(FXCollections.observableArrayList(SSAOTYPES)); ssaoTypePicker.setValue(config.ssaoType.toString()); if (config.ssaoStrength.get() == 0) { ssaoTypePicker.setDisable(true); } ssaoTypePane.getChildren().addAll(ssaoTypeLabel, ssaoTypePicker); // // // //DEPTH OF FIELD OPTIONS // //DOF Override Resolution dofOverridePane = new FlowPane(); dofOverridePane.getStyleClass().add("settings_pane"); dofOverrideLabel = new Label(DOF_OVERRIDE_LABEL + " "); dofOverrideLabel.getStyleClass().addAll("bold_text", "font_12_pt"); dofOverrideLabel.setTooltip(new Tooltip(DOF_OVERRIDE_TT)); dofOverridePicker = new ComboBox(FXCollections.observableArrayList(DOFOVERRIDERESOLUTIONS)); for (int i = 0; i < DOF_OVERRIDE_OPTIONS.length; i++) { if (config.getDOFOverride() == DOF_OVERRIDE_OPTIONS[i]) { dofOverridePicker.setValue(DOFOVERRIDERESOLUTIONS[i]); } } dofOverridePane.getChildren().addAll(dofOverrideLabel, dofOverridePicker); // //DOF Scaling dofScalingPane = new FlowPane(); dofScalingPane.getStyleClass().add("settings_pane"); dofScalingLabel = new Label(DOF_SCALING_LABEL + " "); dofScalingLabel.getStyleClass().addAll("bold_text", "font_12_pt"); dofScalingLabel.setTooltip(new Tooltip(DOF_SCALING_OR_TT)); dofScalingChoice = new ToggleGroup(); dofScalingEnabled = new RadioButton(ENABLE_DISABLE[0] + " "); dofScalingEnabled.setToggleGroup(dofScalingChoice); dofScalingDisabled = new RadioButton(ENABLE_DISABLE[1]); dofScalingDisabled.setToggleGroup(dofScalingChoice); if (config.disableDofScaling.get() == 0) { dofScalingEnabled.setSelected(true); } else { dofScalingDisabled.setSelected(true); } dofScalingPane.getChildren().addAll(dofScalingLabel, dofScalingEnabled, dofScalingDisabled); // //DOF Additional Blur dofAddPane = new FlowPane(); dofAddPane.getStyleClass().add("settings_pane"); dofAddLabel = new Label(DOF_ADD_BLUR_LABEL + " "); dofAddLabel.getStyleClass().addAll("bold_text", "font_12_pt"); dofAddLabel.setTooltip(new Tooltip(DOF_ADD_BLUR_TT)); dofAddPicker = new ComboBox(FXCollections.observableArrayList(DOF_ADDITIONAL_BLUR)); for (int i = 0; i < DOF_ADDITIONAL_BLUR_OPTIONS.length; i++) { if (config.dofBlurAmount.toString().equals(DOF_ADDITIONAL_BLUR_OPTIONS[i])) { dofAddPicker.setValue(DOF_ADDITIONAL_BLUR[i]); } } dofAddPane.getChildren().addAll(dofAddLabel, dofAddPicker); if (config.disableDOF) { dofScalingEnabled.setDisable(true); dofScalingDisabled.setDisable(true); dofAddPicker.setDisable(true); dofOverridePicker.setValue(DOFOVERRIDERESOLUTIONS[5]); setWindowsPresentRes.setDisable(true); presentWidthField.setDisable(true); presentHeightField.setDisable(true); usePresentRes.setDisable(true); dontUsePresentRes.setDisable(true); } // // // //FRAMERATE OPTIONS // //Unlock Framerate unlockFPSPane = new FlowPane(); unlockFPSPane.getStyleClass().add("settings_pane"); unlockFPSLabel = new Label(UNLOCK_FPS_LABEL + " "); unlockFPSLabel.getStyleClass().addAll("bold_text", "font_12_pt"); unlockFPSLabel.setTooltip(new Tooltip(UNLOCK_FPS_TT)); unlockFPSChoice = new ToggleGroup(); fpsLocked = new RadioButton(LOCK_UNLOCK[0] + " "); fpsLocked.setToggleGroup(unlockFPSChoice); fpsUnlocked = new RadioButton(LOCK_UNLOCK[1]); fpsUnlocked.setToggleGroup(unlockFPSChoice); if (config.unlockFPS.get() == 0) { fpsLocked.setSelected(true); } else { fpsUnlocked.setSelected(true); } unlockFPSPane.getChildren().addAll(unlockFPSLabel, fpsLocked, fpsUnlocked); // //Bonfire FPSFix Keybind fpsFixKeyPane = new FlowPane(); fpsFixKeyPane.getStyleClass().add("settings_pane"); fpsFixKeyLabel = new Label(FPS_FIX_KEY_LABEL + " "); fpsFixKeyLabel.getStyleClass().addAll("bold_text", "font_12_pt"); fpsFixKeyLabel.setTooltip(new Tooltip(FPS_FIX_TT)); fpsFixKeyPicker = new ComboBox(FPS_FIX_KEYS_ARRAY_LIST); fpsFixKeyPicker.setTooltip(new Tooltip(FPS_FIX_TT)); fpsFixKeyPane.getChildren().addAll(fpsFixKeyLabel, fpsFixKeyPicker); // fpsFixKey = getFPSFixKey(); if (fpsFixKey != null) { fpsFixKeyPicker.setValue(FPS_FIX_KEYS[FPS_FIX_KEYS_HEX_ARRAY_LIST.indexOf("0x" + fpsFixKey)]); } else { fpsFixKeyPicker.setValue(FPS_FIX_KEYS[4]); fpsFixKeyPicker.setDisable(true); } // //FPS Limit fpsLimitPane = new FlowPane(); fpsLimitPane.getStyleClass().add("settings_pane"); fpsLimitLabel = new Label(FPS_LIMIT_LABEL + " "); fpsLimitLabel.getStyleClass().addAll("bold_text", "font_12_pt"); fpsLimitLabel.setTooltip(new Tooltip(FPS_LIMIT_TT)); fpsLimitField = new TextField("" + config.FPSlimit); fpsLimitField.getStyleClass().add("settings_small_text_field"); fpsLimitPane.getChildren().addAll(fpsLimitLabel, fpsLimitField); // if (config.unlockFPS.get() == 0) { fpsLimitField.setDisable(true); } // //FPS Threshold (for automatic disabling of AA) fpsThresholdPane = new FlowPane(); fpsThresholdPane.getStyleClass().add("settings_pane"); fpsThresholdLabel = new Label(FPS_THRESHOLD_LABEL + " "); fpsThresholdLabel.getStyleClass().addAll("bold_text", "font_12_pt"); fpsThresholdLabel.setTooltip(new Tooltip(FPS_THRESHOLD_TT)); fpsThresholdField = new TextField("" + config.FPSthreshold); fpsThresholdField.getStyleClass().add("settings_small_text_field"); fpsThresholdPane.getChildren().addAll(fpsThresholdLabel, fpsThresholdField); // // // //TEXTURE FILTERING OPTIONS // //Texture Filtering Override texOverridePane = new FlowPane(); texOverridePane.getStyleClass().add("settings_pane"); texOverrideLabel = new Label(TEX_FILTERING_OVERRIDE_LABEL + " "); texOverrideLabel.getStyleClass().addAll("bold_text", "font_12_pt"); texOverrideLabel.setTooltip(new Tooltip(TEX_FILT_OR_TT)); texOverridePicker = new ComboBox(FXCollections.observableArrayList(FILTERINGOVERRIDES)); for (int i = 0; i < FILTERING_OVERRIDE_OPTIONS.length; i++) { if (config.filteringOverride.get() == i) { texOverridePicker.setValue(FILTERINGOVERRIDES[i]); } } texOverridePane.getChildren().addAll(texOverrideLabel, texOverridePicker); primaryVBox.getChildren().addAll(titleBar, restoreDefaultsBar, spacerHBox, renderResPane, presentResPane, aaQualityPane, aaTypePane, ssaoStrengthPane, ssaoScalePane, ssaoTypePane, dofOverridePane, dofScalingPane, dofAddPane, fpsFixKeyPane, unlockFPSPane, fpsLimitPane, fpsThresholdPane, texOverridePane, bottomSpacerHBox); if (config.disableDOF) { dofScalingEnabled.setDisable(true); dofScalingDisabled.setDisable(true); dofAddPicker.setDisable(true); presentWidthField.setDisable(true); presentHeightField.setDisable(true); setWindowsPresentRes.setDisable(true); usePresentRes.setDisable(true); dontUsePresentRes.setDisable(true); dofScalingDisabled.setSelected(true); dofAddPicker.setValue(dofAddPicker.getItems().get(0)); if (usePresentRes.isSelected()) { presentRes[0] = presentWidthField.getText(); presentRes[1] = presentHeightField.getText(); } presentWidthField.setText("0"); presentHeightField.setText("0"); } recheckTextInput(presentWidthField); recheckTextInput(presentHeightField); recheckTextInput(renderWidthField); recheckTextInput(renderHeightField); initializeEventHandlers(); this.setContent(primaryPane); }
From source file:account.management.controller.NewVoucherController.java
@FXML private void onAddNewFieldButtonClick(ActionEvent event) { HBox row = new HBox(); row.setId("field_row"); ComboBox<Account> select_account = new ComboBox<>(); if (this.select_type.getSelectionModel().isEmpty()) { select_account.getItems().addAll(this.account_list); } else {//from ww w . ja v a 2 s. c o m select_account.getItems().addAll(this.filter_acc); } TextField dr = new TextField(); TextField cr = new TextField(); TextField remarks = new TextField(); Button del_row = new Button("Delete"); row.setSpacing(field_row.getSpacing()); ComboBox<Account> combo = (ComboBox) field_row.getChildren().get(0); select_account.setPrefWidth(combo.getPrefWidth()); select_account.setPromptText("Select account"); TextField tf = (TextField) field_row.getChildren().get(1); dr.setPrefWidth(tf.getPrefWidth()); dr.setPromptText("Dr"); tf = (TextField) field_row.getChildren().get(2); cr.setPrefWidth(tf.getPrefWidth()); cr.setPromptText("Cr"); tf = (TextField) field_row.getChildren().get(3); remarks.setPrefWidth(tf.getPrefWidth()); remarks.setPromptText("remarks"); row.getChildren().addAll(select_account, dr, cr, remarks, del_row); field_container.getChildren().add(row); del_row.setOnMouseClicked((MouseEvent event1) -> { field_container.getChildren().removeAll(row); validateFields(); }); combo.setOnAction((e) -> { if (!combo.getSelectionModel().isEmpty() && combo.getSelectionModel().getSelectedItem().getId() == 21) { combo.setPromptText("Select Party"); combo.getItems().clear(); combo.getItems().addAll(this.filter_party_rec); } if (!combo.getSelectionModel().isEmpty() && combo.getSelectionModel().getSelectedItem().getId() == 34) { combo.getItems().clear(); combo.getItems().addAll(this.filter_party_pay); combo.setPromptText("Select Party"); } }); new AutoCompleteComboBoxListener<>(select_account); select_account.setOnHiding((e) -> { Account a = select_account.getSelectionModel().getSelectedItem(); select_account.setEditable(false); select_account.getSelectionModel().select(a); }); select_account.setOnShowing((e) -> { select_account.setEditable(true); }); validateFields(); }
From source file:de.pixida.logtest.designer.testrun.TestRunEditor.java
public TitledPane createPanelForLaunchingTests() { final Button startBtn = new Button("Run Test"); startBtn.disableProperty().bind(this.testRunService.runningProperty()); final double startButtonPadding = 8d; startBtn.setPadding(new Insets(startButtonPadding)); startBtn.setGraphic(Icons.getIconGraphics("control_play_blue")); HBox.setHgrow(startBtn, Priority.ALWAYS); startBtn.setMaxWidth(Double.MAX_VALUE); startBtn.setOnAction(event -> {//w ww . j a va2 s .c o m final Job job = this.createJobFromConfig(); this.testRunService.setJob(job); this.testRunService.start(); }); final HBox startLine = new HBox(); startLine.getChildren().add(startBtn); final VBox runLines = new VBox(); final double linesSpacing = 10d; runLines.setSpacing(linesSpacing); final TextFlow resultBar = new TextFlow(); resultBar.backgroundProperty().bind(this.resultBarBackgroundProperty); this.resultBarBackgroundProperty.set(RESULT_BAR_BACKGROUND_IDLE); resultBar.setStyle("-fx-border-color: black; -fx-border-width:1"); final Text resultBarText = new Text(); resultBarText.textProperty().bind(this.resultBarTextProperty); this.resultBarTextProperty.set("Idle"); resultBar.getChildren().add(resultBarText); resultBar.setTextAlignment(TextAlignment.CENTER); final double resultBarPadding = 2d; resultBar.setPadding(new Insets(resultBarPadding)); final int logOutputLinesSize = 25; this.resultLogOutputText.setPrefRowCount(logOutputLinesSize); this.resultLogOutputText.setEditable(false); this.resultLogOutputText.setStyle("-fx-font-family: monospace"); HBox.setHgrow(this.resultLogOutputText, Priority.ALWAYS); runLines.getChildren().addAll(startLine, new Text("Recent results:"), resultBar, this.resultLogOutputText); final TitledPane runPane = new TitledPane("Run", runLines); runPane.setGraphic(Icons.getIconGraphics("lightning_go")); runPane.setCollapsible(false); return runPane; }
From source file:com.anavationllc.o2jb.ConfigurationApp.java
private Button getOkBtn() { if (okBtn == null) { okBtn = new Button(msg("form.btn.ok")); okBtn.setDisable(true);// www . j ava 2 s.co m okBtn.setMinWidth(Button.USE_PREF_SIZE); okBtn.setPrefWidth(90); okBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent arg0) { _actionTaken = reportAction(msg("action.ok"), getOdbcDsn().getText(), getClassPath().getText(), getDriverClass().getText(), getJdbcUrl().getText(), getUser().getText(), getPassword().getText()); close(); } }); } return okBtn; }
From source file:com.anavationllc.o2jb.ConfigurationApp.java
private Button getCancelBtn() { if (cancelBtn == null) { cancelBtn = new Button(msg("form.btn.cancel")); cancelBtn.setMinWidth(Button.USE_PREF_SIZE); cancelBtn.setPrefWidth(BTN_SIZE); cancelBtn.setOnAction(new EventHandler<ActionEvent>() { @Override/* w w w . j a va 2s .c o m*/ public void handle(ActionEvent arg0) { _actionTaken = reportAction(msg("action.cancelled")); primaryStage.close(); } }); } return cancelBtn; }
From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java
private void createBannedUser(ListView<String> to_update) { Stage createBannedUser = new Stage(); createBannedUser.setTitle("Add Banned User"); createBannedUser.initModality(Modality.APPLICATION_MODAL); GridPane gp = new GridPane(); gp.setPadding(new Insets(25, 25, 25, 25)); gp.setAlignment(Pos.CENTER);//from w ww .j a va 2s .c om gp.setVgap(10); gp.setHgap(10); Text title = new Text("Add Banned Username"); title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20)); gp.add(title, 0, 0, 2, 1); Label newusername = new Label("Ban Username"); TextField username = new TextField(); gp.add(newusername, 0, 1); gp.add(username, 1, 1); Button finish = new Button("Finish"); HBox finish_box = new HBox(10); finish_box.setAlignment(Pos.CENTER); finish_box.getChildren().add(finish); finish.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { banned_usernames.remove(username.getText()); banned_usernames.add(username.getText()); to_update.setItems(FXCollections.observableArrayList(banned_usernames)); createBannedUser.close(); } }); gp.add(finish_box, 0, 2, 2, 1); Scene sc = new Scene(gp, 300, 175); createBannedUser.setScene(sc); createBannedUser.show(); }
From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java
private void createBannedIP(ListView<String> to_update) { Stage createBannedIP = new Stage(); createBannedIP.setTitle("Add Banned IP"); createBannedIP.initModality(Modality.APPLICATION_MODAL); GridPane gp = new GridPane(); gp.setPadding(new Insets(25, 25, 25, 25)); gp.setAlignment(Pos.CENTER);/*w ww . j a v a 2 s . co m*/ gp.setVgap(10); gp.setHgap(10); Text title = new Text("Add Banned IP"); title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20)); gp.add(title, 0, 0, 2, 1); Label newusername = new Label("Ban IP"); TextField username = new TextField(); gp.add(newusername, 0, 1); gp.add(username, 1, 1); Button finish = new Button("Finish"); HBox finish_box = new HBox(10); finish_box.setAlignment(Pos.CENTER); finish_box.getChildren().add(finish); finish.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { banned_ips.remove(username.getText()); banned_ips.add(username.getText()); to_update.setItems(FXCollections.observableArrayList(banned_ips)); createBannedIP.close(); } }); gp.add(finish_box, 0, 2, 2, 1); Scene sc = new Scene(gp, 300, 175); createBannedIP.setScene(sc); createBannedIP.show(); }
From source file:FeeBooster.java
private GridPane cpfpGrid(Transaction tx) { // Setup Grid GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER);/*from w w w .j a v a 2 s . co m*/ grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); int gridheight = 0; // Add outputs to table Label outputHdrLbl = new Label("Outputs"); grid.add(outputHdrLbl, 1, gridheight); gridheight++; ToggleGroup outputGroup = new ToggleGroup(); for (int i = 0; i < tx.getOutputs().size(); i++) { // Add output to table TxOutput out = tx.getOutputs().get(i); Text outputTxt = new Text("Amount " + out.getValue() + " Satoshis\nAddress: " + out.getAddress()); outputTxt.setUserData(i); grid.add(outputTxt, 0, gridheight); // Add radio button to table RadioButton radio = new RadioButton(); radio.setUserData(i); radio.setToggleGroup(outputGroup); radio.setSelected(true); grid.add(radio, 1, gridheight); gridheight++; } // Fee Text fee = new Text("Fee to Pay: " + tx.getFee() + " Satoshis"); grid.add(fee, 0, gridheight); // Recommended fee from bitcoinfees.21.co JSONObject apiResult = Utils.getFromAnAPI("http://bitcoinfees.21.co/api/v1/fees/recommended", "GET"); int fastestFee = apiResult.getInt("fastestFee"); long recommendedFee = fastestFee * tx.getSize() + fastestFee * 300; Text recFeeTxt = new Text("Recommended Fee: " + recommendedFee + " Satoshis"); grid.add(recFeeTxt, 1, gridheight); gridheight += 2; // Instructions Text instructions = new Text("Choose an output to spend from. Set the total transaction fee below."); grid.add(instructions, 0, gridheight, 3, 1); gridheight++; // Fee spinner Spinner feeSpin = new Spinner((double) tx.getFee(), (double) tx.getTotalAmt(), (double) tx.getFee()); feeSpin.setEditable(true); grid.add(feeSpin, 0, gridheight); feeSpin.valueProperty().addListener(new ChangeListener() { @Override public void changed(ObservableValue observable, Object oldValue, Object newValue) { double oldVal = (double) oldValue; double newVal = (double) newValue; Double step = newVal - oldVal; tx.setFee(tx.getFee() + step.longValue()); fee.setText("Fee to Pay: " + tx.getFee() + " Satoshis"); } }); // Set to recommended fee button Button recFeeBtn = new Button("Set fee to recommended"); grid.add(recFeeBtn, 1, gridheight); gridheight++; recFeeBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { long prevFee = tx.getFee(); long step = recommendedFee - prevFee; feeSpin.increment((int) step); } }); // Output address Label recvAddr = new Label("Address to pay to"); grid.add(recvAddr, 0, gridheight); TextField outAddr = new TextField(); grid.add(outAddr, 1, gridheight); gridheight++; // Next Button Button nextBtn = new Button("Next"); nextBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { if (sceneCursor == scenes.size() - 1) { // Referenced output int output = (int) outputGroup.getSelectedToggle().getUserData(); TxOutput refout = tx.getOutputs().get(output); // Create output for CPFP transaction TxOutput out = null; long outval = refout.getValue() - ((Double) feeSpin.getValue()).longValue(); if (Utils.validateAddress(outAddr.getText())) { byte[] decodedAddr = Utils.base58Decode(outAddr.getText()); boolean isP2SH = decodedAddr[0] == 0x00; byte[] hash160 = Arrays.copyOfRange(decodedAddr, 1, decodedAddr.length - 4); if (isP2SH) { byte[] script = new byte[hash160.length + 3]; script[0] = (byte) 0xa9; script[1] = (byte) 0x14; System.arraycopy(hash160, 0, script, 2, hash160.length); script[script.length - 1] = (byte) 0x87; out = new TxOutput(outval, script); } else { byte[] script = new byte[hash160.length + 5]; script[0] = (byte) 0x76; script[1] = (byte) 0xa9; script[2] = (byte) 0x14; System.arraycopy(hash160, 0, script, 3, hash160.length); script[script.length - 2] = (byte) 0x88; script[script.length - 1] = (byte) 0xac; out = new TxOutput(outval, script); } } else { Alert alert = new Alert(Alert.AlertType.ERROR, "Invalid Address"); alert.showAndWait(); return; } // Create CPFP Transaction Transaction cpfpTx = new Transaction(); TxInput in = new TxInput(tx.getHash(), output, new byte[] { (0x00) }, 0xffffffff); cpfpTx.addOutput(out); cpfpTx.addInput(in); // Create Scene Scene scene = new Scene(unsignedTxGrid(cpfpTx), 900, 500); scenes.add(scene); sceneCursor++; stage.setScene(scene); } else { sceneCursor++; stage.setScene(scenes.get(sceneCursor)); } } }); HBox btnHbox = new HBox(10); // Back Button Button backBtn = new Button("Back"); backBtn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { sceneCursor--; stage.setScene(scenes.get(sceneCursor)); } }); btnHbox.getChildren().add(backBtn); btnHbox.getChildren().add(nextBtn); // Cancel Button Button cancelBtn = new Button("Cancel"); cancelBtn.setOnAction(cancelEvent); btnHbox.getChildren().add(cancelBtn); grid.add(btnHbox, 1, gridheight); return grid; }
From source file:com.github.drbookings.ui.controller.BookingDetailsController.java
private void addRow5(final Pane content, final BookingBean be) { final HBox box = new HBox(); box.setPadding(new Insets(4)); box.setFillHeight(true);// w w w . j av a 2 s. c o m final Text text = new Text("Welcome Mail sent: "); final CheckBox checkBox = new CheckBox(); checkBox.setSelected(be.isWelcomeMailSend()); booking2WelcomeMail.put(be, checkBox); final Text t1 = new Text(" \tPayment done: "); final CheckBox cb1 = new CheckBox(); cb1.setSelected(be.isPaymentDone()); //if (logger.isDebugEnabled()) { // logger.debug("DateOfPayment for " + be + "(" + be.hashCode() + ") is " + be.getDateOfPayment()); //} final DatePicker dp = new DatePicker(); dp.setValue(be.getDateOfPayment()); dp.setPrefWidth(140); booking2PaymentDate.put(be, dp); booking2Payment.put(be, cb1); final TextFlow tf = new TextFlow(); tf.getChildren().addAll(text, checkBox, t1, cb1, dp); box.getChildren().add(tf); if (!be.isWelcomeMailSend() || !be.isPaymentDone()) { box.getStyleClass().addAll("warning", "warning-bg"); } else { box.getStyleClass().removeAll("warning", "warning-bg"); } HBox box2 = new HBox(); box2.setPadding(new Insets(4)); box2.setFillHeight(true); TextField newPayment = new TextField(); Button addNewPaymentButton = new Button("Add payment"); addNewPaymentButton.setOnAction(e -> { addNewPayment(newPayment.getText(), be); }); box2.getChildren().addAll(newPayment, addNewPaymentButton); content.getChildren().addAll(box, box2); }
From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java
private void createBannedPlayername(ListView<String> to_update) { Stage createBannedPlayername = new Stage(); createBannedPlayername.setTitle("Add Banned Playername"); createBannedPlayername.initModality(Modality.APPLICATION_MODAL); GridPane gp = new GridPane(); gp.setPadding(new Insets(25, 25, 25, 25)); gp.setAlignment(Pos.CENTER);/*from w ww.j a v a2 s. c o m*/ gp.setVgap(10); gp.setHgap(10); Text title = new Text("Add Banned Playername"); title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20)); gp.add(title, 0, 0, 2, 1); Label newusername = new Label("Ban Playername"); TextField username = new TextField(); gp.add(newusername, 0, 1); gp.add(username, 1, 1); Button finish = new Button("Finish"); HBox finish_box = new HBox(10); finish_box.setAlignment(Pos.CENTER); finish_box.getChildren().add(finish); finish.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { banned_playernames.remove(username.getText()); banned_playernames.add(username.getText()); to_update.setItems(FXCollections.observableArrayList(banned_playernames)); createBannedPlayername.close(); } }); gp.add(finish_box, 0, 2, 2, 1); Scene sc = new Scene(gp, 300, 175); createBannedPlayername.setScene(sc); createBannedPlayername.show(); }