@Override public void start(Stage primaryStage) throws Exception { BorderPane outerPane = new BorderPane(); HBox topBox = new HBox(20); HBox bottomBox = new HBox(20); outerPane.setCenter(newText); fontChoice.setValue("Times New Roman"); sizeChoice.setValue(12); topBox.setPadding(new Insets(20, 20, 20, 20)); bottomBox.setPadding(new Insets(20, 20, 20, 20)); List<String> items = Font.getFamilies(); fontChoice.getItems().addAll(items); for (int i = 1; i <= 100; i++) sizeChoice.getItems().add(i); topBox.getChildren().addAll(fontName, fontChoice, fontSize, sizeChoice); bottomBox.getChildren().addAll(bold, italic); topBox.setAlignment(Pos.CENTER); bottomBox.setAlignment(Pos.CENTER); outerPane.setTop(topBox); outerPane.setCenter(newText); outerPane.setBottom(bottomBox); fontChoice.setOnAction( e -> { setFont(); }); sizeChoice.setOnAction( e -> { setFont(); }); bold.setOnAction( e -> { setFont(); }); italic.setOnAction( e -> { setFont(); }); Scene scene = new Scene(outerPane, X, Y); primaryStage.setScene(scene); primaryStage.show(); }
public OptionalEditor(PropertySheet.Item parameter) { if (!(parameter instanceof OptionalParameter)) throw new IllegalArgumentException(); optionalParameter = (OptionalParameter<?>) parameter; embeddedParameter = optionalParameter.getEmbeddedParameter(); // The checkbox checkBox = new CheckBox(); setLeft(checkBox); // Add embedded editor try { Class<? extends PropertyEditor<?>> embeddedEditorClass = embeddedParameter.getPropertyEditorClass().get(); embeddedEditor = embeddedEditorClass .getDeclaredConstructor(PropertySheet.Item.class) .newInstance(embeddedParameter); Node embeddedNode = embeddedEditor.getEditor(); Boolean value = optionalParameter.getValue(); if (value == null) value = false; embeddedNode.setDisable(!value); checkBox.setOnAction( e -> { embeddedNode.setDisable(!checkBox.isSelected()); }); setCenter(embeddedNode); } catch (Exception e) { throw (new IllegalStateException(e)); } }
private void display() { initModality(Modality.APPLICATION_MODAL); setTitle("Student Review"); setMinWidth(250); setMinHeight(300); signOutButton = new Button("SignOut"); signOutButton.setOnAction(event -> signOutInDB()); buttonHBox = new HBox(signOutButton); buttonHBox.setAlignment(Pos.CENTER_RIGHT); studentInfo = new RegistrationStudentInfoEntryBox(); // Disabling all fields setValue(studentInfo.getEmplIdTextField(), String.valueOf(student.getEmplId())); setValue(studentInfo.getFirstNameTextField(), student.getFirstName()); setValue(studentInfo.getLastNameTextField(), student.getLastName()); studentInfo.getYearChoiceBox().setValue(student.getYear()); studentInfo.getYearChoiceBox().setDisable(true); theTutor = new ChoiceBox<>(); theTutor.getItems().addAll(Tutor.values()); theTutorLabel = new Label("Tutor "); theTutorLayout = new HBox(); theTutorLayout.getChildren().addAll(theTutorLabel, theTutor); is135 = new CheckBox("Discussed 135 Topics? "); is135.setOnAction(event -> handleListView()); // Hidden until is135 is checked levelOfLearning = new ChoiceBox<>(); levelOfLearning.getItems().addAll(1, 2, 3, 4); levelOfLearningLabel = new Label("Level Of Learning "); levelOfLearningLayout = new HBox(); levelOfLearningLayout.getChildren().addAll(levelOfLearningLabel, levelOfLearning); levelOfLearningLayout.setVisible(false); levelOfLearningLayout.setManaged(false); // Hidden until is135 is checked topicsListView = new ListView<>(); topicsListView.getItems().addAll(Topics135.values()); topicsListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); topicsListView.setVisible(false); topicsListView.setManaged(false); vertical135Layout = new VBox(10); vertical135Layout.getChildren().addAll(is135, levelOfLearningLayout, topicsListView); mainVBox = new VBox(20); mainVBox.getChildren().addAll(studentInfo, theTutorLayout, vertical135Layout, buttonHBox); mainVBox.setMargin(vertical135Layout, new Insets(0, 20, 0, 20)); mainVBox.setMargin(buttonHBox, new Insets(20)); mainVBox.setAlignment(Pos.TOP_CENTER); scene = new Scene(mainVBox); setScene(scene); showAndWait(); }
public void setFddObjectModel(FddObjectModel fddObjectModel) { logger.entry(); if (fddObjectModel != null) { fddObjectModel .getInteractionClasses() .values() .stream() .forEach( (value) -> { interactions.add(new InteractionState(value)); }); InteractionTableView.setItems(interactions); interactions.forEach( (interaction) -> { interaction .onProperty() .addListener( (observable, oldValue, newValue) -> { if (!newValue) { cb.setSelected(false); } else if (interactions.stream().allMatch(a -> a.isOn())) { cb.setSelected(true); } }); }); InteractionTableColumn.setCellValueFactory(new PropertyValueFactory<>("interactionName")); CheckTableColumn.setCellValueFactory( new Callback< TableColumn.CellDataFeatures<InteractionState, Boolean>, ObservableValue<Boolean>>() { @Override public ObservableValue<Boolean> call( TableColumn.CellDataFeatures<InteractionState, Boolean> param) { return param.getValue().onProperty(); } }); CheckTableColumn.setCellFactory(CheckBoxTableCell.forTableColumn(CheckTableColumn)); cb.setUserData(CheckTableColumn); cb.setOnAction( (ActionEvent event) -> { CheckBox cb1 = (CheckBox) event.getSource(); TableColumn tc = (TableColumn) cb1.getUserData(); InteractionTableView.getItems() .stream() .forEach( (item) -> { item.setOn(cb1.isSelected()); }); }); CheckTableColumn.setGraphic(cb); } logger.exit(); }
protected FxSidebarPasswordbox(ApplicationInstance instance) { final JavaFxUserInterfaceApi fxUI = JavaFxUserInterface.getInstance(instance); row = new BorderPane(); inputElement = createPasswordbox(instance, true); row.setCenter(inputElement); CheckBox showPw = new CheckBox(fxUI.getLocaleBundleString("passwordfield.show_password")); showPw.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { if (showPw.isSelected()) { TextField t = new TextField(getUIValue()); t.addEventFilter( KeyEvent.KEY_RELEASED, new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { storeData(instance.getTree().getSelectedNode()); } }); inputElement = t; } else { inputElement = createPasswordbox(instance, false); } row.setCenter(inputElement); } }); row.setBottom(showPw); Button copy = new Button("", ImageMap.getFxImageView(("icon_copy"))); copy.setMinWidth(16); copy.setMaxWidth(16); copy.setTooltip(new Tooltip(fxUI.getLocaleBundleString("mainwindow.menu.edit.copy_text"))); copy.getStyleClass().add("noBorder"); copy.setFocusTraversable(false); copy.setOnAction((event) -> fxUI.setClipboardText(getUIValue())); row.setRight(copy); }
@Override public void start(Stage primaryStage) throws Exception { // UI fields VBox mainBox = new VBox(); sequenceField = new TextField(myLabels.TEXTAREA_SEQUENCE); bracketField = new TextField(myLabels.TEXTAREA_BRACKET); HBox buttonBox = new HBox(); Button computeButton = new Button(myLabels.BUTTON_COMPUTE); Button drawButton = new Button(myLabels.BUTTON_DRAW); CheckBox animateChecker = new CheckBox(myLabels.CHECKBOX_ANIMATE); drawPane = new Pane(); buttonBox.getChildren().addAll(computeButton, drawButton, animateChecker); mainBox.getChildren().addAll(sequenceField, bracketField, buttonBox, drawPane); // Compute Button disable sequenceField .textProperty() .addListener( (observable, oldValue, newValue) -> { if (newValue.length() == 0) { computeButton.setDisable(true); } else { computeButton.setDisable(false); } }); // Animate Checkbox animateChecker.setOnAction( (value) -> { if (animateChecker.isSelected() != isAnimated) { isAnimated = animateChecker.isSelected(); // set Eventhandler für Drag & Drop for (Circle currentCircle : circleList) { currentCircle.setOnMousePressed(isAnimated ? circleOnMousePressedEventHandler : null); currentCircle.setOnMouseDragged(isAnimated ? circleOnMouseDraggedEventHandler : null); currentCircle.setOnMouseReleased( isAnimated ? circleOnMouseReleasedEventHandler : null); } } }); // computeButton computeButton.setOnAction( (value) -> { bracketField.setText(new Nussinov(sequenceField.getText()).getBracketNotation()); }); // drawButton drawButton.setOnAction( (value) -> { Graph myGraph = new Graph(); try { myGraph.parseNotation(bracketField.getText()); } catch (IOException e) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle(myLabels.ALERT_TITLE); alert.setHeaderText(myLabels.ALTERT_MESSAGE); alert.setContentText(bracketField.getText()); alert.showAndWait(); } coordsRepresentation[0] = SpringEmbedder.computeSpringEmbedding( iterations, myGraph.getNumberOfNodes(), myGraph.getEdges(), null); SpringEmbedder.centerCoordinates(coordsRepresentation[0], 50, 550, 50, 550); drawShapes( drawPane, coordsRepresentation[0], myGraph.getEdges(), myGraph.getNumberOfNodes()); }); // prepare scene Scene scene = new Scene(mainBox, 600, 800); primaryStage.setScene(scene); primaryStage.setTitle(myLabels.CAPTION); // show scene primaryStage.show(); }
@Override public void initialize(URL url, ResourceBundle rb) { loading.setVisible(false); checkTodos.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { boolean checked = ((CheckBox) t.getTarget()).isSelected(); for (Node node : servicos.getChildren()) { ((CheckBox) node).setSelected(checked); } } }); unidades.setItems(FXCollections.observableList(new ArrayList<ComboboxItem>())); unidades.setOnAction( new EventHandler() { @Override public void handle(Event t) { loading.setVisible(true); checkTodos.setSelected(false); ComboBox cb = (ComboBox) t.getTarget(); cb.getSelectionModel().selectedItemProperty(); ComboboxItem item = (ComboboxItem) cb.getSelectionModel().selectedItemProperty().getValue(); if (item != null && Integer.parseInt(item.getKey()) > 0) { unidadeAtual = Integer.parseInt(item.getKey()); updateServicos(main.getService().buscarServicos(unidadeAtual)); } loading.setVisible(false); } }); buscar.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { loading.setVisible(true); servicos.getChildren().clear(); unidadeAtual = 0; try { main.getService() .loadUrls( servidor.getText(), new Runnable() { @Override public void run() { updateUnidades(main.getService().buscarUnidades()); loading.setVisible(false); } }); } catch (Exception e) { loading.setVisible(false); } } }); salvar.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { loading.setVisible(true); try { List<Integer> idServicos = new ArrayList<Integer>(); for (Node node : servicos.getChildren()) { if (((CheckBox) node).isSelected()) { try { String id = node.getId().split("-")[1]; idServicos.add(Integer.parseInt(id)); } catch (Exception e) { } } } PainelConfig config = main.getConfig(); config.get(PainelConfig.KEY_SERVER).setValue(servidor.getText()); config.get(PainelConfig.KEY_UNIDADE, Integer.class).setValue(unidadeAtual); config .get(PainelConfig.KEY_SERVICOS, Integer[].class) .setValue(idServicos.toArray(new Integer[0])); // som e tema config.get(PainelConfig.KEY_SCREENSAVER_URL).setValue(videoUrl.getText()); config .get(PainelConfig.KEY_LANGUAGE) .setValue( ((ComboboxItem) language.getSelectionModel().getSelectedItem()).getKey()); config .get(PainelConfig.KEY_SOUND_VOICE, Boolean.class) .setValue(vocalizar.isSelected()); config.get(PainelConfig.KEY_COR_FUNDO).setValue(colorToHex(corFundo.getValue())); config .get(PainelConfig.KEY_COR_MENSAGEM) .setValue(colorToHex(corMensagem.getValue())); config.get(PainelConfig.KEY_COR_SENHA).setValue(colorToHex(corSenha.getValue())); config.get(PainelConfig.KEY_COR_GUICHE).setValue(colorToHex(corGuiche.getValue())); // screensaver layout config .get(PainelConfig.KEY_SCREENSAVER_LAYOUT, Integer.class) .setValue( Integer.parseInt(((RadioButton) svLayout.getSelectedToggle()).getText())); config.save(); main.getService().register(servidor.getText()); } catch (Exception e) { e.printStackTrace(); } loading.setVisible(false); } }); exibirPainel.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { main.getPainel().show(); } }); // language language.setItems(FXCollections.observableList(new ArrayList<ComboboxItem>())); SortedSet<String> keys = new TreeSet<String>(Main.locales.keySet()); for (String key : keys) { language.getItems().add(new ComboboxItem(key, Main.locales.get(key))); if (Locale.getDefault().getLanguage().equals(key)) { main.getConfig().get(PainelConfig.KEY_LANGUAGE).setValue(Locale.getDefault().getLanguage()); } } String defaultLang = main.getConfig().get(PainelConfig.KEY_LANGUAGE).getValue(); for (Object item : language.getItems()) { if (defaultLang.equals(((ComboboxItem) item).getKey())) { language.getSelectionModel().select(item); break; } } language.setOnAction( new EventHandler() { @Override public void handle(Event t) { ComboBox cb = (ComboBox) t.getTarget(); cb.getSelectionModel().selectedItemProperty(); ComboboxItem item = (ComboboxItem) cb.getSelectionModel().selectedItemProperty().getValue(); main.getConfig().get(PainelConfig.KEY_LANGUAGE).setValue(item.getKey()); } }); // video monitorId.setItems(FXCollections.observableList(new ArrayList<ComboboxItem>())); Integer defaultId = main.getConfig().get(PainelConfig.KEY_MONITOR_ID, Integer.class).getValue(); for (int i = 0; i < Screen.getScreens().size(); i++) { StringBuilder sb = new StringBuilder(); Rectangle2D b = Screen.getScreens().get(i).getBounds(); sb.append(i + 1) .append(" (") .append(b.getWidth()) .append(" x ") .append(b.getHeight()) .append(")"); ComboboxItem item = new ComboboxItem(i, sb.toString()); monitorId.getItems().add(item); if (defaultId.equals(i)) { monitorId.getSelectionModel().select(item); } } monitorId.setOnAction( new EventHandler() { @Override public void handle(Event t) { ComboBox cb = (ComboBox) t.getTarget(); cb.getSelectionModel().selectedItemProperty(); ComboboxItem item = (ComboboxItem) cb.getSelectionModel().selectedItemProperty().getValue(); Integer key = Integer.parseInt(item.getKey()); if (key >= 0 && key < Screen.getScreens().size()) { main.getConfig().get(PainelConfig.KEY_MONITOR_ID, Integer.class).setValue(key); } } }); // screen saver screenSaverTimeout.setItems(FXCollections.observableList(new ArrayList<ComboboxItem>())); Integer defaultTimeout = main.getConfig().get(PainelConfig.KEY_SCREENSAVER_TIMEOUT, Integer.class).getValue(); SortedSet<Integer> keys2 = new TreeSet<Integer>(Main.intervals.keySet()); for (Integer key : keys2) { ComboboxItem item = new ComboboxItem(key, Main.intervals.get(key)); screenSaverTimeout.getItems().add(item); if (defaultTimeout.equals(key)) { screenSaverTimeout.getSelectionModel().select(item); } } screenSaverTimeout.setOnAction( new EventHandler() { @Override public void handle(Event t) { ComboBox cb = (ComboBox) t.getTarget(); cb.getSelectionModel().selectedItemProperty(); ComboboxItem item = (ComboboxItem) cb.getSelectionModel().selectedItemProperty().getValue(); main.getConfig() .get(PainelConfig.KEY_SCREENSAVER_TIMEOUT, Integer.class) .setValue(Integer.parseInt(item.getKey())); } }); fileChooser.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { FileChooser fileChooser = new FileChooser(); fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("MP4", "*.mp4")); fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("AVI", "*.avi")); fileChooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("HLS", "*.m3u8")); try { File file = fileChooser.showOpenDialog(null); videoUrl.setText(file.toURI().toString()); } catch (Exception e) { } } }); testVideo.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { try { String url = videoUrl.getText(); if (url != null && !url.isEmpty()) { if (tester != null) { tester.destroy(); } tester = new VideoTester(url.trim()); Stage painelStage = new Stage(); painelStage.initOwner(stage); painelStage.setOnCloseRequest( new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent t) { tester.destroy(); } }); tester.start(painelStage); } } catch (Exception e) { e.printStackTrace(); } } }); // screesaver layout - marcando o padrao try { int id = main.getConfig().get(PainelConfig.KEY_SCREENSAVER_LAYOUT, Integer.class).getValue(); svLayout.getToggles().get(id - 1).setSelected(true); } catch (Exception e) { } // criando stage this.stage = new Stage(); stage.setTitle("Painel | Novo SGA"); stage.setScene(new Scene(getRoot())); // so esconde se suportar systray if (SystemTray.isSupported()) { final Controller self = this; stage.setOnCloseRequest( new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent t) { self.stage.hide(); } }); } }
public void setAnimationCheckboxHandler(EventHandler<ActionEvent> handler) { animateCheckbox.setOnAction(handler); }
/* ADMIN SCENE */ public void start(Stage primaryStage) throws Exception { /** Done by Marco */ primaryStage.setTitle("PubFinder"); primaryStage.setResizable(false); PubDataAccessor.PubDataAccessor(); /*Welcome scene*/ WelcomeScene.welcomeScene(); welcomeScene = WelcomeScene.welcomeScene; /*Welcome scene*/ /** End of Marcos Work */ /** Done by Shafiq and Anotnino */ /* Admin add scene*/ AdminAddScene.adminAddscene(); adminAddScene = AdminAddScene.adminAddScene; /* Admin add scene*/ /*Admin login scene*/ AdminLoginScene.adminloginscene(); adminLoginScene = AdminLoginScene.adminLoginScene; /*Admin login scene*/ /*Admin choice scene*/ AdminChoiceScene.adminchoicescene(); adminChoiceScene = AdminChoiceScene.adminChoiceScene; /*Admin choice scene*/ /* Admin Edit Scene*/ adminEditScene = AdminEditScene.editScene; /* Admin Edit Scene*/ /** End of Shafiq and Anotonino's Work */ /*Pub button scene*/ pubLayout = new StackPane(); /** Done by Ahmad */ searchNameInput = new TextField(); searchNameInput.setId("search-field"); searchNameInput.setPromptText("NAME"); /** End of Ahmad's Work */ searchStreetInput = new TextField(); searchStreetInput.setId("search-field"); searchStreetInput.setPromptText("STREET"); searchAgeInput = new TextField(); searchAgeInput.setId("search-field"); searchAgeInput.setPromptText("AGE"); /** Done by Aseel */ CheckBox searchStudentDiscount = new CheckBox("DISCOUNTS"); CheckBox searchBySpecialEvents = new CheckBox("EVENTS"); CheckBox searchWithoutFees = new CheckBox("NO FEES"); searchStudentDiscount.setId("check-search"); searchBySpecialEvents.setId("check-search"); searchWithoutFees.setId("check-search"); ComboBox searchByRating = new ComboBox( FXCollections.observableArrayList( "\uF005", "\uF005\uF005", "\uF005\uF005\uF005", "\uF005\uF005\uF005\uF005", "\uF005\uF005\uF005\uF005\uF005")); searchByRating.setTooltip(new Tooltip("RATING")); searchByRating.setPromptText("RATING"); searchByRating.setId("combo-search"); ComboBox searchByArea = new ComboBox( FXCollections.observableArrayList( "All", "Avenyn", "Linné", "Haga", "Järntorget", "Magasinsgatan", "Vasastaden", "Gamlestaden", "Heden", "Masthugget", "Stigberget", "Other")); searchByArea.setTooltip(new Tooltip("AREA")); searchByArea.setPromptText("AREA"); searchByArea.setId("combo-search"); /** End of Aseel's Work */ /** Done by Marco */ pubLayout.setId("pubs"); search = new Button("SEARCH"); search.setId("button-search"); GridPane inputGrid = new GridPane(); inputGrid.setMaxHeight(100); inputGrid.setHgap(10); inputGrid.setVgap(10); inputGrid.setId("searchGrid"); StackPane.setAlignment(inputGrid, Pos.TOP_LEFT); StackPane.setAlignment(search, Pos.TOP_RIGHT); /** End of Marco's Work */ search.setOnAction(e -> searchForPubs()); /** Done by Ahmad */ searchNameInput.setOnKeyReleased( event1 -> { if (event1.getCode() == KeyCode.ENTER) { searchForPubs(); } }); /** End of Ahmad's Work */ /** Done by Marco */ searchStreetInput.setOnKeyReleased( event2 -> { if (event2.getCode() == KeyCode.ENTER) { searchForPubs(); } }); /** End of Marco's Work */ /** Done by Ahmad */ searchAgeInput.setOnKeyReleased( event3 -> { if (event3.getCode() == KeyCode.ENTER) { searchForPubs(); } }); /** End of Ahmad's Work */ /** Done by Shafiq & Anotnino */ searchStudentDiscount.setOnAction( event4 -> { if (searchStudentDiscount.isSelected()) { discount = 1; } if (!searchStudentDiscount.isSelected()) { discount = 0; } }); searchWithoutFees.setOnAction( event5 -> { if (searchWithoutFees.isSelected()) { fee = 0; } if (!searchWithoutFees.isSelected()) { fee = 1; } }); searchBySpecialEvents.setOnAction( event6 -> { if (searchBySpecialEvents.isSelected()) { searchEvent = true; } if (!searchBySpecialEvents.isSelected()) { searchEvent = false; } }); searchByRating.setOnAction( event7 -> { if (searchByRating.getSelectionModel().isSelected(0)) { numberOfStars = 1; } else if (searchByRating.getSelectionModel().isSelected(1)) { numberOfStars = 2; } else if (searchByRating.getSelectionModel().isSelected(2)) { numberOfStars = 3; } else if (searchByRating.getSelectionModel().isSelected(3)) { numberOfStars = 4; } else if (searchByRating.getSelectionModel().isSelected(4)) { numberOfStars = 5; } }); /** End of Shafiq and Anotino's Work */ /** Done by Aseel and Antonino */ searchByArea.setOnAction( event8 -> { if (searchByArea.getSelectionModel().isSelected(0)) { area_checker = 2; } if (searchByArea.getSelectionModel().isSelected(1)) { area = 0; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(2)) { area = 2; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(3)) { area = 3; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(4)) { area = 4; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(5)) { area = 5; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(6)) { area = 6; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(7)) { area = 7; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(8)) { area = 8; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(9)) { area = 9; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(10)) { area = 10; area_checker = 1; } else if (searchByArea.getSelectionModel().isSelected(11)) { area = 11; area_checker = 1; } }); /** End of Aeel and Antonino's Work */ /** Done by marco */ ScrollPane pubScroll = new ScrollPane(); pubScroll.setId("scroll"); pubScroll.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); pubScroll.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); pubs = new GridPane(); pubScroll.setContent(pubs); pubs.setId("pub-grid"); pubs.setAlignment(Pos.CENTER); pubLayout.getChildren().add(pubScroll); inputGrid.add(searchNameInput, 1, 1); inputGrid.add(searchStreetInput, 2, 1); inputGrid.add(searchAgeInput, 3, 1); inputGrid.add(searchByRating, 4, 1); inputGrid.add(searchByArea, 5, 1); inputGrid.add(searchStudentDiscount, 6, 1); inputGrid.add(searchBySpecialEvents, 7, 1); inputGrid.add(searchWithoutFees, 8, 1); pubLayout.getChildren().add(inputGrid); pubLayout.getChildren().add(search); noPub = new Label("No pubs found"); searchForPubs(); pubScene = new Scene(pubLayout, 1000, 600); pubScene.getStylesheets().addAll(this.getClass().getResource("style.css").toExternalForm()); /*Pub button scene*/ /*Pub scene*/ ScrollPane pubPageLayout = new ScrollPane(); pubPageLayout.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); pubPageLayout.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); pubPageLayout.setFitToWidth(true); pubPageLayout.setContent(xPane); xPane.setId("pubScene"); pubPageLayout.setId("gej"); star.setId("starButton"); eventLabel.setId("eventLabel"); /*Items*/ xPane.add(back, 1, 1); back.setId("button-logout"); back.setOnAction( (event) -> { primaryStage.setScene(pubScene); xPane .getChildren() .removeAll(description, rating, overlay, pubName, map, star, rates, events); descriptionGrid .getChildren() .removeAll(age, open, address, type, discountForStudents, entranceFees); events.getChildren().removeAll(eventDescriptionGrid); eventDescriptionGrid.getChildren().removeAll(eventLabel, eventPane); eventPane.getChildren().removeAll(eventGrid); eventGrid.getChildren().removeAll(eventName, eventDescription); star.setText("0 \uF08A"); star.setStyle( "#starButton{-fx-text-fill: #fff;} #starButton:hover{-fx-text-fill: #fff;}"); }); /** End of Marco's work */ /** Done by Shafiq & Antonino */ star.setOnAction( event -> { int rate = PubDataAccessor.checkRate(this.id); int rateUpdate = rate + 1; /** End of Shafiq & Antonino's Work */ /** Done by marco */ star.setText((rateUpdate) + " \uF004"); PubDataAccessor.updateRate(this.id); star.setStyle("-fx-text-fill: #731a2b;"); }); overlay.setHeight(header.getFitHeight()); overlay.setWidth(header.getFitWidth() + 24); overlay.setX(0); overlay.setY(0); overlay.fillProperty().set(javafx.scene.paint.Color.rgb(115, 26, 43, 0.3)); pubPage = new Scene(pubPageLayout, 1000, 600); pubPage.getStylesheets().addAll(this.getClass().getResource("style.css").toExternalForm()); /*Pub scene*/ primaryStage.setScene(welcomeScene); primaryStage.show(); Main.primaryStage = primaryStage; /** End of Marcos work */ }