public void init() { /* Image img1 = new Image(TermProjectMain.class.getResourceAsStream("bkash.png")); bkash.setImage(img1); Image img2 = new Image(TermProjectMain.class.getResourceAsStream("sure cash.png")); sureCash.setImage(img2); Image img3 = new Image(TermProjectMain.class.getResourceAsStream("dutch bangla.png")); DBBL.setImage(img3); Image img4 = new Image(TermProjectMain.class.getResourceAsStream("mastercard.png")); masterCard.setImage(img4); Image img5 = new Image(TermProjectMain.class.getResourceAsStream("visa.png")); visa.setImage(img5); */ // fromBoxList.setAll(options); // toBoxList.setAll(options); // fromComboBox.getItems().addAll(fromBoxList); c = new clientInfo(); fromComboBox.getItems().addAll(options); // toComboBox.getItems().addAll(toBoxList); toComboBox.getItems().addAll(options); fromComboBox.setVisibleRowCount(4); toComboBox.setVisibleRowCount(4); // the code fragment below ensures that no day before today is selected from the datePicker by // disabling the selecting option for those days and marking them in pink color final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() { @Override public DateCell call(final DatePicker datePicker) { return new DateCell() { @Override public void updateItem(LocalDate item, boolean empty) { super.updateItem(item, empty); if (item.isBefore(LocalDate.now())) { setDisable(true); setStyle("-fx-background-color: #ffc0cb;"); } } }; } }; datePick.setDayCellFactory(dayCellFactory); datePick.setEditable(false); final ToggleGroup group = new ToggleGroup(); ACradioButton.setToggleGroup(group); nonACradioButton.setToggleGroup(group); }
@Override public void initialize(URL arg0, ResourceBundle arg1) { presenter = new Presenter(); FXMLParameter = new ParametriFXML(null, false); rdMaschio.setToggleGroup(group); rdMaschio.setSelected(true); rdFemmina.setToggleGroup(group); dEmissPatente.setValue(LocalDate.of(1980, 1, 1)); dNascita.setValue(LocalDate.of(1980, 1, 1)); }
@Override public void start(Stage pPrimaryStage) { aText.setText(PART_1); pPrimaryStage.setTitle("Welcome to COMP303"); aButton.setOnAction(this); aSkin.selectedToggleProperty().addListener(this); RadioButton rb1 = new RadioButton("Plain"); rb1.setToggleGroup(aSkin); rb1.setUserData("Plain"); rb1.setSelected(true); RadioButton rb2 = new RadioButton("Floral"); rb2.setUserData("Floral"); rb2.setToggleGroup(aSkin); RadioButton rb3 = new RadioButton("Chintz"); rb3.setUserData("Chintz"); rb3.setToggleGroup(aSkin); VBox centerPanel = new VBox(MARGIN); centerPanel.setPadding(new Insets(MARGIN)); centerPanel.setAlignment(Pos.CENTER); centerPanel.getChildren().addAll(aText, aButton); BorderPane root = new BorderPane(); root.setCenter(centerPanel); HBox bottomPanel = new HBox(MARGIN); bottomPanel.setPadding(new Insets(MARGIN)); bottomPanel.setAlignment(Pos.CENTER); bottomPanel.getChildren().addAll(rb1, rb2, rb3); root.setBottom(bottomPanel); aScene = new Scene(root, WIDTH, HEIGHT); pPrimaryStage.setResizable(false); pPrimaryStage.setScene(aScene); pPrimaryStage.show(); }
public RadioButtons() { super(400, 100); ToggleGroup tg = new ToggleGroup(); VBox vbox = new VBox(); vbox.setSpacing(5); RadioButton rb1 = new RadioButton("Hello"); rb1.setToggleGroup(tg); RadioButton rb2 = new RadioButton("Bye"); rb2.setToggleGroup(tg); rb2.setSelected(true); RadioButton rb3 = new RadioButton("Disabled"); rb3.setToggleGroup(tg); rb3.setSelected(false); rb3.setDisable(true); vbox.getChildren().add(rb1); vbox.getChildren().add(rb2); vbox.getChildren().add(rb3); getChildren().add(vbox); }
private HBox initGUIcenterRechtsDatenbank() { HBox zeile = new HBox(20); zeile.setPadding(new Insets(5, 5, 5, 5)); zeile.setStyle(Css.boxhellblaugrau()); TextArea antwortDatenbank = new TextArea(); antwortDatenbank.getStyleClass().add("textareaFlat"); antwortDatenbank.setStyle(Css.focusrahmenWeg()); antwortDatenbank.setEditable(false); antwortDatenbank.setPrefRowCount(3); antwortDatenbank.setPrefColumnCount(25); antwortDatenbank.setWrapText(true); RahmenTitelWeiss rahmenAntwortDatenbank = new RahmenTitelWeiss("Antwort Datenbank", antwortDatenbank); VBox senkrecht = new VBox(5); Label schildchenAktion = new Label("Aktion"); schildchenAktion.setStyle(CssExtras.titel()); ToggleGroup gruppe = new ToggleGroup(); RadioButton knopfArchivieren = new RadioButton("aktivieren"); knopfArchivieren.setToggleGroup(gruppe); RadioButton knopfLöschen = new RadioButton("löschen"); knopfLöschen.setToggleGroup(gruppe); senkrecht.getChildren().add(schildchenAktion); senkrecht.getChildren().add(knopfArchivieren); senkrecht.getChildren().add(knopfLöschen); Button knopfSenden = new Button("senden"); zeile.getChildren().add(rahmenAntwortDatenbank); zeile.getChildren().add(senkrecht); zeile.getChildren().add(knopfSenden); return zeile; }
/** * Called after @FXML annotated fields are injected and so is used to update the view with the * data built in the constructor. * * <p>Retrieves history and achievement information from the account to build the charts and set * the text for attribute and username labels. * * <p>First displays the user's workout activity in the last seven days but the user is allowed to * switch between last 30 days/ last 7 days charts */ @FXML private void initialize() { // build the series from the workout history information workoutHistoryLog = HistoryAnalyser.getDailyWorkoutHistoryFromCurrentAccount(); makeWeekSeriesFromAccountHistory(); makeMonthSeriesFromAccountHistory(); // ----------------------------------------------------------// // Character attributes and avatar // Get the authenticated and up to date account and get its attributes Account account = Main.account; attributes = account.getCharacterAttributes(); // ----------------------------------------------------------// // Progress charts // immediately remove the line chart that displays the last 30 days of workout activity from // view monthLineChart.setVisible(false); // add the series to their charts weekBarChart.getData().add(seriesW); monthLineChart.getData().add(seriesM); // manage the toggling feature between month and weekRadios radioGroup = new ToggleGroup(); monthRadio.setToggleGroup(radioGroup); weekRadio.setToggleGroup(radioGroup); // Initially set week radio to selected weekRadio.setSelected(true); showAccountAttributes(); showAvatarInStackPane(); showAchievementsInListView(); }
/** * Initializes the RadioButton, permits to know if a file or a directory needs to be transformed */ private void initializeRadioButtons() { folderRadio.setToggleGroup(this.radioFileGroup); fileRadio.setToggleGroup(this.radioFileGroup); this.radioFileGroup .selectedToggleProperty() .addListener( new ChangeListener<Toggle>() { @Override public void changed( ObservableValue<? extends Toggle> observable, Toggle oldValue, Toggle newValue) { if (fileRadio.isSelected()) { selectFileButton.setText("Select your subtitle file !"); isFileToConvert = true; } else { selectFileButton.setText("Select your subtitles folder !"); isFileToConvert = false; } buttonRemoveSubs.setDisable(true); } }); fileRadio.setSelected(true); }
@Override public void initialize(URL arg0, ResourceBundle arg1) { textTrackName.setText(track.getName()); textDynamicRange.setText(String.format("%.2f dB", track.getDynamicRange())); drawTrack(); radioButtonActiveTrack.setToggleGroup(toggleGroup); radioButtonActiveTrack.setUserData(new WeakReference<>(track)); if (toggleGroup.getSelectedToggle() == null) { radioButtonActiveTrack.setSelected(true); } textAreaComment.textProperty().bindBidirectional(track.commentProperty()); }
public static Tuple2<Label, RadioButton> addLabelRadioButton( GridPane gridPane, int rowIndex, ToggleGroup toggleGroup, String title, String radioButtonTitle) { Label label = addLabel(gridPane, rowIndex, title, 0); RadioButton radioButton = new RadioButton(radioButtonTitle); radioButton.setToggleGroup(toggleGroup); radioButton.setPadding(new Insets(6, 0, 0, 0)); GridPane.setRowIndex(radioButton, rowIndex); GridPane.setColumnIndex(radioButton, 1); gridPane.getChildren().add(radioButton); return new Tuple2<>(label, radioButton); }
private void initContent(GridPane pane) { pane.setGridLinesVisible(!true); pane.setPadding(new Insets(20)); pane.setHgap(10); pane.setVgap(10); Label names = new Label("Names:"); pane.add(names, 0, 1); Label name = new Label("Name:"); pane.add(name, 0, 3); this.names = new ListView<String>(); pane.add(this.names, 1, 1, 1, 2); this.names.setPrefWidth(200); this.names.setPrefHeight(200); this.names.getItems().setAll(this.boyNames); // GridPane.setMargin(this.boyNames, new Insets(-25, 0, 0, 0)); this.name = new TextField(); pane.add(this.name, 1, 3, 1, 1); HBox box = new HBox(20); pane.add(box, 1, 0); this.namesGroup = new ToggleGroup(); String[] gender = {"Boy", "Girl"}; for (String s : gender) { RadioButton rb = new RadioButton(); rb.setToggleGroup(this.namesGroup); rb.setText(s); box.getChildren().add(rb); rb.setSelected(true); } ChangeListener<Toggle> listener = (ov, oldValue, newValue) -> this.namesToggleSelected(); this.namesGroup.selectedToggleProperty().addListener(listener); Button add_name = new Button("Add"); pane.add(add_name, 4, 3); add_name.setOnAction(event -> this.add_name()); }
private VBox createMultipleQuestion(QuestionSubmit submit) { String correct = ""; RadioButton button; multipleChoiceText.setText(submit.getQuestion()); possebilityVBox.getChildren().clear(); choises = new ToggleGroup(); if (answerForQuestion.containsKey(submit)) { correct = answerForQuestion.get(submit).getAnswer(); } for (String possibility : submit.getPossibilities()) { button = new RadioButton(possibility); button.setToggleGroup(choises); if (possibility.equals(correct)) { button.selectedProperty().set(true); } possebilityVBox.getChildren().add(button); } return multipleChoiseVbox; }
public ConfigurationsDialogBuilder addConfigurations(List<Configuration> configurations) { dialog.setTitle("Choose a configuration to graph"); dialog.configurations = configurations; dialog.borderPanel.setCenter(dialog.scrollPane); ObservableList<Node> children = dialog.configurationsBox.getChildren(); ToggleGroup toggleGroup = new ToggleGroup(); for (Configuration configuration : configurations) { String name = configuration.getName(); RadioButton configurationRadioButton = new RadioButton(name); configurationRadioButton.setToggleGroup(toggleGroup); if (name.equals("compile")) { configurationRadioButton.setSelected(true); // todo select default from prefs } children.add(configurationRadioButton); } return this; }
public void addTrip(ViaggioGruppo viaggoGruppo) { int i; int from = gpPack.getChildren().size(); int fromRow = gpPackRow; RadioButton rb = new RadioButton(); rb.setId(Integer.toString(viaggoGruppo.getVid())); rb.setToggleGroup(this.tg); rb.setOnAction(this::buildRight); gpPack.add(new Label(viaggoGruppo.getNumPacket().getNome()), 0, gpPackRow); gpPack.add(new Label(Integer.toString(viaggoGruppo.getNumPacket().getPrezzo())), 1, gpPackRow); gpPack.add( new Label(viaggoGruppo.getNumPacket().getOffertaPernotto().getCittà()), 2, gpPackRow); gpPack.add( new Label(viaggoGruppo.getNumPacket().getOffertaPernotto().getTipologia()), 4, gpPackRow); gpPack.add( new Label(Integer.toString(viaggoGruppo.getNumPacket().getOffertaPernotto().getStelle())), 5, gpPackRow); gpPack.add( new Label( Integer.toString(viaggoGruppo.getNumPacket().getOffertaPernotto().getNumeroNotti())), 6, gpPackRow); gpPack.add( new Label(viaggoGruppo.getNumPacket().getOffertaTrasporto().getCittàPartenza()), 8, gpPackRow); gpPack.add( new Label(viaggoGruppo.getNumPacket().getOffertaTrasporto().getTipologia()), 9, gpPackRow); gpPack.add( new Label(Integer.toString(viaggoGruppo.getNumPacket().getOffertaTrasporto().getDurata())), 10, gpPackRow); gpPack.add(rb, 20, gpPackRow); gpPack.add(new Label(Integer.toString(viaggoGruppo.getMinP())), 15, gpPackRow); gpPack.add(new Label(Integer.toString(viaggoGruppo.getMaxP())), 16, gpPackRow); gpPack.add(new Label(Double.toString(viaggoGruppo.getDiscount())), 17, gpPackRow); gpPack.add(new Label(Integer.toString(viaggoGruppo.getNumreserved())), 18, gpPackRow); int j = 0; for (OffertaEvento events : viaggoGruppo.getNumPacket().getOffertaEvento()) { gpPack.add(new Label(events.getNome()), 12, gpPackRow); gpPack.add(new Label(events.getTipologia()), 13, gpPackRow); j += 2; gpPackRow++; } Separator separator = new Separator(); gpPack.add(separator, 0, gpPackRow, 19, 1); gpPackRow++; Separator separator1 = new Separator(); separator1.setOrientation(Orientation.VERTICAL); Separator separator2 = new Separator(); separator2.setOrientation(Orientation.VERTICAL); Separator separator3 = new Separator(); separator3.setOrientation(Orientation.VERTICAL); Separator separator4 = new Separator(); separator4.setOrientation(Orientation.VERTICAL); Separator separator5 = new Separator(); separator4.setOrientation(Orientation.VERTICAL); gpPack.add(separator1, 3, fromRow, 1, viaggoGruppo.getNumPacket().getOffertaEvento().size()); gpPack.add(separator2, 7, fromRow, 1, viaggoGruppo.getNumPacket().getOffertaEvento().size()); gpPack.add(separator3, 11, fromRow, 1, viaggoGruppo.getNumPacket().getOffertaEvento().size()); gpPack.add(separator4, 14, fromRow, 1, viaggoGruppo.getNumPacket().getOffertaEvento().size()); gpPack.add(separator5, 19, fromRow, 1, viaggoGruppo.getNumPacket().getOffertaEvento().size()); }
@Override public void start(Stage theStage) { this.tStage = theStage; theStage.setTitle("Ball of Duty"); theStage.setHeight(WINDOW_START_HEIGHT); theStage.setWidth(WINDOW_START_WIDTH); theStage.centerOnScreen(); theStage.setResizable(false); theStage.setOnCloseRequest( new EventHandler<WindowEvent>() { public void handle(WindowEvent we) { gameManager.quitGame(); System.exit(0); } }); BorderPane startMenuRoot = new BorderPane(); startMenu = new Scene(startMenuRoot); gameBox = new BorderPane(); Scene gameScene = new Scene(gameBox); BorderPane createAccountRoot = new BorderPane(); BorderPane lohInRoot = new BorderPane(); theStage.setScene(startMenu); gameManager = new GameClient(getRelativeSceneLocation(theStage)); scale = new Scale(); scale.xProperty().bind(gameScene.widthProperty().divide(WINDOW_START_WIDTH)); scale.yProperty().bind(gameScene.heightProperty().divide(WINDOW_START_HEIGHT)); scale.setPivotX(0); scale.setPivotY(0); // gameBox.getTransforms().add(scale); // gameBox.setBackground(null); // TODO scaling theStage .heightProperty() .addListener( e -> { gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); // This // only // happens // once // for // some // reason. }); theStage .widthProperty() .addListener( e -> { gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); }); theStage .xProperty() .addListener( e -> { gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); }); theStage .yProperty() .addListener( e -> { gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); }); gameScene .xProperty() .addListener( e -> { gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); }); gameScene .yProperty() .addListener( e -> { gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); }); Image image = new Image("images/frontpage.png"); BackgroundSize backgroundSize = new BackgroundSize(100, 100, true, true, true, false); // new BackgroundImage(image, repeatX, repeatY, position, size) BackgroundImage backgroundImage = new BackgroundImage( image, BackgroundRepeat.REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, backgroundSize); // new Background(images...) Background background = new Background(backgroundImage); startMenuRoot.setBackground(background); RadioButton chooseBlaster = new RadioButton("Blaster"); RadioButton chooseRoller = new RadioButton("Roller"); RadioButton chooseHeavy = new RadioButton("Heavy"); final ToggleGroup specializationGroup = new ToggleGroup(); chooseBlaster.setToggleGroup(specializationGroup); chooseRoller.setToggleGroup(specializationGroup); chooseHeavy.setToggleGroup(specializationGroup); chooseBlaster.setSelected(true); HBox specializationBox = new HBox(); specializationBox.setSpacing(9); specializationBox.getChildren().add(chooseBlaster); specializationBox.getChildren().add(chooseRoller); specializationBox.getChildren().add(chooseHeavy); Label lblNickname = new Label("Nickname:"); TextField tfNickname = new TextField(); Button loginStart = new Button("Log in"); Button createStart = new Button("Create Account"); theStage.getIcons().add(new Image("images/ball_red.png")); VBox mainButtonBox = new VBox(); mainButtonBox.setSpacing(5); Button joinBtn = new Button("Join game"); Button viewLB = new Button("Leaderboard"); viewLB.setPrefSize(150, 50); viewLB.setId("viewLB"); viewLB.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); BorderPane lbBorder = new BorderPane(); VBox lbBox = new VBox(); Scene lbScene = new Scene(lbBorder); Button lbBack = new Button("Start menu"); lbBox.getChildren().add(lbBack); lbBorder.setLeft(lbBox); lbBack.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); Label topText = new Label("Only shows scores higher than 100!"); topText.setStyle("-fx-font-size: 20pt;-fx-font-family: Segoe UI Semibold;"); viewLB.setOnAction( ActionEvent -> { HighscoreLeaderboard hBoard = gameManager.getHighscoreLeaderboard(); hBoard.setFocusTraversable(false); lbBorder.setCenter(hBoard); if (gameManager.getPlayer() != null) { Player client = gameManager.getPlayer(); Label you = new Label( "YOU: " + client.getNickname() + " [" + client.getId() + "] | Score: " + client.getHighscore()); you.setStyle("-fx-font-size: 15pt;-fx-font-family: Segoe UI Semibold;"); lbBorder.setBottom(you); } BorderPane.setMargin(hBoard, new Insets(12, 12, 12, 12)); lbBorder.setTop(topText); theStage.setScene(lbScene); lbBack.setOnAction( ActionEvent1 -> { theStage.setScene(startMenu); startMenuRoot.setLeft(mainButtonBox); BorderPane.setMargin(mainButtonBox, new Insets(350, 0, 0, 150)); }); }); joinBtn.setPrefSize(150, 50); tfNickname.setPrefSize(150, 20); joinBtn.setId("joinBtn"); joinBtn.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); lblNickname.setId("lblNickname"); lblNickname.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); createStart.setId("CreateStart"); createStart.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); loginStart.setId("loginStart"); loginStart.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); joinBtn.setOnAction( ActionEvent -> { Specializations spec; if (chooseRoller.isSelected()) { spec = Specializations.ROLLER; } else if (chooseHeavy.isSelected()) { spec = Specializations.HEAVY; } else // Blaster is default, if something goes wrong with radio // buttons { spec = Specializations.BLASTER; } theStage.setScene(gameScene); gameManager.joinAsGuest(gameBox, tfNickname.getText(), spec); gameManager.getMap().addObserver(this); gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); gameBox.requestFocus(); }); tfNickname.setOnAction( ActionEvent -> { Specializations spec; if (chooseRoller.isSelected()) { spec = Specializations.ROLLER; } else if (chooseHeavy.isSelected()) { spec = Specializations.HEAVY; } else // Blaster is default, if something goes wrong with radio // buttons { spec = Specializations.BLASTER; } theStage.setScene(gameScene); gameManager.joinAsGuest(gameBox, tfNickname.getText(), spec); gameManager.setSceneRelativeLocation(getRelativeSceneLocation(theStage)); gameBox.requestFocus(); }); mainButtonBox.getChildren().add(lblNickname); mainButtonBox.getChildren().add(tfNickname); mainButtonBox.getChildren().add(specializationBox); mainButtonBox.getChildren().add(joinBtn); mainButtonBox.getChildren().add(loginStart); mainButtonBox.getChildren().add(createStart); mainButtonBox.getChildren().add(viewLB); startMenuRoot.setLeft(mainButtonBox); createStart.setOnAction( ActionEvent -> { VBox createAccountButtonBox = new VBox(); Label lblNickname2 = new Label("Nickname:"); TextField tfNickname2 = new TextField(); Label lblUserName = new Label("Name:"); TextField tfUserName = new TextField(); Label lblPassword = new Label("Password:"******"Repeat password:"******"Create account"); Button back = new Button("Start menu"); createBtn.setId("join-yyyyy"); createBtn.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); lblUserName.setId("join-game"); lblUserName.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); lblPassword.setId("join-game"); lblPassword.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); lblPassword2.setId("join-game"); lblPassword2.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); back.setId("join-game"); back.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); createAccountButtonBox.getChildren().add(lblNickname2); createAccountButtonBox.getChildren().add(tfNickname2); createAccountButtonBox.getChildren().add(lblUserName); createAccountButtonBox.getChildren().add(tfUserName); createAccountButtonBox.getChildren().add(lblPassword); createAccountButtonBox.getChildren().add(pf); createAccountButtonBox.getChildren().add(lblPassword2); createAccountButtonBox.getChildren().add(pf2); createAccountButtonBox.getChildren().add(createBtn); createAccountButtonBox.getChildren().add(back); startMenuRoot.setLeft(createAccountButtonBox); BorderPane.setMargin(createAccountButtonBox, new Insets(350, 0, 0, 150)); createBtn.setOnAction( ActionEvent1 -> { gameManager.createAccount( tfUserName.getText(), tfNickname2.getText(), pf.getText().toCharArray(), pf2.getText().toCharArray()); startMenuRoot.setLeft(mainButtonBox); BorderPane.setMargin(mainButtonBox, new Insets(350, 0, 0, 150)); }); back.setOnAction( ActionEvent1 -> { startMenuRoot.setLeft(mainButtonBox); BorderPane.setMargin(mainButtonBox, new Insets(350, 0, 0, 150)); }); }); loginStart.setOnAction( ActionEvent -> { VBox loginButtonBox = new VBox(); Button logInBtn = new Button("Log in"); Label lblUserName2 = new Label("Name:"); TextField tfUserName2 = new TextField(); Label lblPassword2 = new Label("Password:"******"Start Menu"); logInBtn.setId("join-game"); logInBtn.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); back2.setId("join-game"); back2.setStyle("-fx-font: 20 arial; -fx-base: #ff0717;"); loginButtonBox.getChildren().add(lblUserName2); loginButtonBox.getChildren().add(tfUserName2); loginButtonBox.getChildren().add(lblPassword2); loginButtonBox.getChildren().add(pf3); loginButtonBox.getChildren().add(logInBtn); loginButtonBox.getChildren().add(back2); startMenuRoot.setLeft(loginButtonBox); BorderPane.setMargin(loginButtonBox, new Insets(350, 0, 0, 150)); logInBtn.setOnAction( ActionEvent1 -> { // TODO login }); back2.setOnAction( ActionEvent1 -> { startMenuRoot.setLeft(mainButtonBox); BorderPane.setMargin(mainButtonBox, new Insets(350, 0, 0, 150)); }); }); BorderPane.setMargin(mainButtonBox, new Insets(350, 0, 0, 150)); Button quitBtn = new Button("Quit game"); quitBtn.setPrefSize(80, 40); quitBtn.setId("quit-game"); quitBtn.setOnAction( ActionEvent -> { gameManager.quitGame(); theStage.setScene(startMenu); }); canvas = new Canvas(CANVAS_START_WIDTH, CANVAS_START_HEIGHT); gameBox.setCenter(canvas); BorderPane.setAlignment(canvas, Pos.TOP_LEFT); gameBox.setBottom(quitBtn); BorderPane.setAlignment(quitBtn, Pos.TOP_LEFT); theStage.show(); }
public void iniciarAcceso() { radbtnPrestable.setToggleGroup(acceso); radbtnNoPrestable.setToggleGroup(acceso); }
/** * When the component is created, it initialize the component representation and adding listener * and MouseEvent * * @param location type URL * @param resources type ResourceBundle */ @Override public void initialize(final URL location, final ResourceBundle resources) { super.initialize(location, resources); // Configure exponential potentiometer expFrequency .valueProperty() .addListener( (observable, oldValue, newValue) -> { vcoa.setExponentialFrequency((double) newValue); updateScreen(); linFrequency.setMinValue( String.valueOf( (int) (vcoa.getLinearFrequencyMin() * vcoa.getExponentialFrequency()))); linFrequency.setMaxValue( String.valueOf( (int) (vcoa.getLinearFrequencyMax() * vcoa.getExponentialFrequency()))); }); expFrequency.setTitle("Exp. Freq."); expFrequency.setMinValue(0); expFrequency.setMaxValue(16); // Configure linear potentiometer linFrequency .valueProperty() .addListener( (observable, oldValue, newValue) -> { vcoa.setLinearFrequency((Double) newValue); updateScreen(); }); linFrequency.setTitle("Linear Freq."); // Configure amplitude potentiometer amplitude .valueProperty() .addListener( (observable, oldValue, newValue) -> { vcoa.setAmplitudeOscillator((Double) newValue); }); amplitude.setTitle("Amplitude"); amplitude.setMinValue("0%"); amplitude.setMaxValue("100%"); sineRadio.setToggleGroup(groupRadio); squareRadio.setToggleGroup(groupRadio); triangleRadio.setToggleGroup(groupRadio); sawtoothRadio.setToggleGroup(groupRadio); sineRadio.setUserData("sineWave"); squareRadio.setUserData("squareWave"); triangleRadio.setUserData("triangleWave"); sawtoothRadio.setUserData("sawtoothWave"); groupRadio .selectedToggleProperty() .addListener( (observable, oldValue, newValue) -> { if (groupRadio.getSelectedToggle() != null) { final Image image = new Image( getClass() .getResourceAsStream( "/ui/images/" + groupRadio.getSelectedToggle().getUserData() + ".png")); oscillatorImage.setImage(image); switch (groupRadio.getSelectedToggle().getUserData().toString()) { case "sineWave": vcoa.setOscillatorType(OscillatorType.SINE); break; case "squareWave": vcoa.setOscillatorType(OscillatorType.SQUARE); break; case "triangleWave": vcoa.setOscillatorType(OscillatorType.TRIANGLE); break; case "sawtoothWave": vcoa.setOscillatorType(OscillatorType.SAWTOOTH); break; default: break; } } }); squareRadio.setSelected(true); }
/** * Initializes the controller class. This method is automatically called after fxml file has been * loaded. */ @FXML private void initialize() { // setting up the radioButtons final ToggleGroup timeIntervalGroup = new ToggleGroup(); monthlyRadioButton.setToggleGroup(timeIntervalGroup); dailyRadioButton.setToggleGroup(timeIntervalGroup); hourlyRadioButton.setToggleGroup(timeIntervalGroup); fifteenMinRadioButton.setToggleGroup(timeIntervalGroup); fifteenMinRadioButton.setSelected(true); final ToggleGroup typOfChartGroup = new ToggleGroup(); regularTimeSeriesRadioButton.setToggleGroup(typOfChartGroup); scatterRadioButton.setToggleGroup(typOfChartGroup); dailyTypeOfDayRadioButton.setToggleGroup(typOfChartGroup); regularTimeSeriesRadioButton.setSelected(true); final ToggleGroup typeOfDayGroup = new ToggleGroup(); schoolDayRadioButton.setToggleGroup(typeOfDayGroup); summerDayRadioButton.setToggleGroup(typeOfDayGroup); holidayRadioButton.setToggleGroup(typeOfDayGroup); weekendRadioButton.setToggleGroup(typeOfDayGroup); everyDayRadioButton.setToggleGroup(typeOfDayGroup); everyDayRadioButton.setSelected(true); updateEnabledButtons(); // initialize a unique instance of the database database = Database.getInstance(); // initialize the meter table with all the columns. meterNumberColumn.setCellValueFactory(cellData -> cellData.getValue().getMeterNumber()); meterTable.setEditable(true); meterNumberColumn.setCellFactory(TextFieldTableCell.forTableColumn()); meterNumberColumn.setOnEditCommit( new EventHandler<TableColumn.CellEditEvent<Meter, String>>() { @Override public void handle(CellEditEvent<Meter, String> event) { event .getTableView() .getItems() .get(event.getTablePosition().getRow()) .setMeterNumber(Assistant.parsePropertiesString(event.getNewValue())); } }); startDateColumn.setCellValueFactory( cellData -> Assistant.parsePropertiesString(cellData.getValue().getStartDate().toString())); endDateColumn.setCellValueFactory( cellData -> Assistant.parsePropertiesString(cellData.getValue().getEndDate().toString())); activatedColumn.setCellFactory(cellData -> new CheckBoxCell()); colorColumn.setCellFactory(cellData -> new ColorButtonCell(java.awt.Color.GREEN)); initializeDateTable(); }