public FinalGame() { sp = new Button(); sp.setAlignment(Pos.CENTER); sp.setText("Start"); sp.setPrefSize(160, 80); stop = new Button(); stop.setAlignment(Pos.CENTER); stop.setText("Stop"); stop.setPrefSize(160, 80); exit = new Button(); exit.setAlignment(Pos.CENTER); exit.setText("Exit"); exit.setPrefSize(200, 80); mv = new Label(); mv.setId("mv"); mv.setAlignment(Pos.CENTER); mv.setText("MOVES"); mv.setPrefSize(200, 80); lvl = new Label(); lvl.setId("lvl"); lvl.setAlignment(Pos.CENTER); lvl.setText("LEVEL"); lvl.setPrefSize(200, 80); clock = new Label(); clock.setId("clock"); clock.setAlignment(Pos.CENTER); clock.setText("TIMER"); clock.setPrefSize(200, 80); hc = new Label(); hc.setId("hc"); hc.setAlignment(Pos.CENTER); hc.setText("HIGH SCORE"); hc.setPrefSize(200, 80); gpane = new GridPane(); gpane.setId("pane"); iv = new ImageView[16]; rct = new Rectangle2D[17]; rct[0] = new Rectangle2D(0, 0, 80, 80); rct[1] = new Rectangle2D(80, 0, 80, 80); rct[2] = new Rectangle2D(160, 0, 80, 80); rct[3] = new Rectangle2D(240, 0, 80, 80); rct[4] = new Rectangle2D(0, 80, 80, 80); rct[5] = new Rectangle2D(80, 80, 80, 80); rct[6] = new Rectangle2D(160, 80, 80, 80); rct[7] = new Rectangle2D(240, 80, 80, 80); rct[8] = new Rectangle2D(0, 160, 80, 80); rct[9] = new Rectangle2D(80, 160, 80, 80); rct[10] = new Rectangle2D(160, 160, 80, 80); rct[11] = new Rectangle2D(240, 160, 80, 80); rct[12] = new Rectangle2D(0, 240, 80, 80); rct[13] = new Rectangle2D(80, 240, 80, 80); rct[14] = new Rectangle2D(160, 240, 80, 80); rct[16] = new Rectangle2D(240, 240, 80, 80); rct[15] = new Rectangle2D(320, 0, 80, 80); iniGame(); addObjects(); }
static GridPane createGUI() { /** TODO update */ GridPane gridpane = new GridPane(); gridpane.setId("SysInfoGUI"); // Setting alignment gridPaneAlignment.gridPaneAlign(gridpane); gridpane.setAlignment(Pos.CENTER); /** * Column constraints to set the min, pref and max width for the columns. Only applies to the * topgridpane, hence the top preface :) */ ColumnConstraints topLeftColumn = new ColumnConstraints(75, 125, 300); topLeftColumn.setHalignment(HPos.RIGHT); // ColumnConstraints topCenterColumn = new ColumnConstraints(150, 250, 300); // ColumnConstraints topRightColumn = new ColumnConstraints(50, 100, 300); gridpane.getColumnConstraints().addAll(topLeftColumn); /** Left Column */ Label labelWinVer = new Label("Windows Version: "); gridpane.add(labelWinVer, 0, 0); gridpane.add(getWinVers(), 1, 0); Label labelSysManufac = new Label("Manufacturer: "); gridpane.add(labelSysManufac, 0, 1); gridpane.add(getSysMan(), 1, 1); Label labelSysModel = new Label("Model: "); gridpane.add(labelSysModel, 0, 2); gridpane.add(getSysModel(), 1, 2); Label labelSysSerial = new Label("Serial: "); gridpane.add(labelSysSerial, 0, 3); gridpane.add(getSysSerial(), 1, 3); Label labelCompName = new Label("Computer Name: "); gridpane.add(labelCompName, 0, 4); gridpane.add(getCompName(), 1, 4); /** Center Column */ Label labelProcessor = new Label("Processor: "); gridpane.add(labelProcessor, 0, 5); gridpane.add(getProcModel(), 1, 5); Label labelInstalledMem = new Label("Installed Memory: "); gridpane.add(labelInstalledMem, 0, 6); gridpane.add(getTotalMem(), 1, 6); Label labelHDDSize = new Label("Hard Drive Size: "); gridpane.add(labelHDDSize, 0, 7); gridpane.add(getHddSize(), 1, 7); Label labelHDDFreeSpace = new Label("Free Space: "); gridpane.add(labelHDDFreeSpace, 0, 8); gridpane.add(getHddFree(), 1, 8); /** Right Column */ Label labelIPAddress = new Label("Local IP Address: "); gridpane.add(labelIPAddress, 0, 9); gridpane.add(getLocalIP(), 1, 9); Label labelSubnet = new Label("Subnet: "); gridpane.add(labelSubnet, 0, 10); gridpane.add(getSubnet(), 1, 10); Label labelGateway = new Label("Gateway: "); gridpane.add(labelGateway, 0, 11); gridpane.add(getGateway(), 1, 11); Label labelPublicIP = new Label("Public IP: "); gridpane.add(labelPublicIP, 0, 12); gridpane.add(getPublicIP(), 1, 12); return gridpane; }
public BoardView(int noPlayers, final Stage primaryStage) { window = primaryStage; window.setTitle("Quoridor"); window.setMaxHeight(1280); window.setMaxWidth(1280); window.setResizable(false); BorderPane border = new BorderPane(); infoPane = new FlowPane(); infoPane.setPadding(new Insets(10)); infoPane.setHgap(40); infoPane.setVgap(10); infoPane.setOrientation(Orientation.HORIZONTAL); bottomPane = new HBox(); bottomPane.setSpacing(345); gameGrid = new GridPane(); gameGrid.setPadding(new Insets(4)); gameGrid.setId("gamegrid"); border.setTop(infoPane); border.setCenter(gameGrid); playerPositionButtons = new PlayerPositionButton[9][9]; wallPositionButtons = new WallPositionButton[9][8]; horizontalWalls = new Pane[9][9]; verticalWalls = new Pane[9][9]; column = 0; row = 0; chooseVertical = new Button(); chooseVertical.setPrefSize(100, 100); chooseVertical.setId("vWallBtn"); Button home = new Button(); home.setPrefSize(100, 100); home.setId("home"); home.setOnAction(e -> confirmBox()); bottomPane.getChildren().addAll(chooseVertical, home); border.setBottom(bottomPane); border.setMargin(bottomPane, new Insets(40, 40, 20, 20)); for (int y = 0; y < 8; y++) { createMoveLine(y); createWallLine(y); } createMoveLine(8); main = new Scene(border, 600, 768); main.getStylesheets().add("gameplay/viewJFX/" + stylesheet); buildPlayerLabels(noPlayers); window.setScene(main); window.show(); }
public static void createStartTownSaloonView() { GridPane gridPane = new GridPane(); gridPane.setHgap(2); gridPane.setVgap(2); gridPane.setId("saloonGridBackground"); Button backBtn = new Button("Back"); backBtn.setId("mainScreenBtn"); gridPane.add(backBtn, 0, 0); URL url = StartTownSaloonView.class.getClassLoader().getResource("resources/saloonPianoMusic.mp3"); assert url != null; final Media media = new Media(url.toString()); final MediaPlayer mediaPlayer = new MediaPlayer(media); mediaPlayer.setVolume(25); mediaPlayer.setCycleCount(99); mediaPlayer.play(); Scene scene = new Scene( gridPane, Main.getPrimaryStage().getScene().getWidth(), Main.getPrimaryStage().getScene().getHeight()); scene.getStylesheets().add("resources/main.css"); ArrayList<Tooltip> tooltipArrayList = new ArrayList<>(); AddKeyListenerToScene.addGeneralKeyListener(scene); /** * Need to add a bunch of collision detection rectangles for clicking on people and getting a * toolip to popup. */ scene.setOnMouseClicked( event -> { double x = event.getX(); double y = event.getY(); for (Tooltip eraseTooltip : tooltipArrayList) { eraseTooltip.hide(); } if (x >= 767.0 && x <= 814.0 && y >= 378.0 && y <= 461.0) { Tooltip bartender = new Tooltip("What can I get ya?"); bartender.setId("startTownSaloonTooltip"); bartender.show( gridPane, 776.0 + scene.getWindow().getX(), 407.0 + scene.getWindow().getY()); tooltipArrayList.add(bartender); } if (x >= 687.0 && x <= 759.0 && y >= 387.0 && y <= 507.0) { Tooltip oldManAtTheBar = new Tooltip("Whiskey, Mmm Mmm Mmm down to my belly, yum yum yum...*hiccup*"); oldManAtTheBar.setId("startTownSaloonTooltip"); oldManAtTheBar.show( gridPane, 745.0 + scene.getWindow().getX(), 432.0 + scene.getWindow().getY()); tooltipArrayList.add(oldManAtTheBar); } if (x >= 43.0 && x <= 102.0 && y >= 330.0 && y <= 545.0) { Tooltip banjoPlayerInBack = new Tooltip("Yoddle yoddleeeee yoddleeeeheeeehoooo..."); banjoPlayerInBack.setId("startTownSaloonTooltip"); banjoPlayerInBack.show( gridPane, 83.0 + scene.getWindow().getX(), 356.0 + scene.getWindow().getY()); tooltipArrayList.add(banjoPlayerInBack); } if (x >= 606.0 && x <= 662.0 && y >= 383.0 && y <= 688.0) { Tooltip secretAlienTechHintDude = new Tooltip( "I was out in the fields...staring\n" + "at the sky when suddenly a huge blinding\n" + "light shot up from the ground. Aliens man\n" + "I hope they left something behind for me to\n" + "find!"); secretAlienTechHintDude.setId("startTownSaloonTooltip"); secretAlienTechHintDude.show( gridPane, 645.0 + scene.getWindow().getX(), 428.0 + scene.getWindow().getY()); tooltipArrayList.add(secretAlienTechHintDude); } if (x >= 923.0 && x <= 1029.0 && y >= 385.0 && y <= 752.0) { Tooltip guyHittingOnGirlOnRight = new Tooltip("Sup baby gurrllllll"); guyHittingOnGirlOnRight.setId("startTownSaloonTooltip"); guyHittingOnGirlOnRight.show( gridPane, 952.0 + scene.getWindow().getX(), 427.0 + scene.getWindow().getY()); tooltipArrayList.add(guyHittingOnGirlOnRight); } /** * Set listeners for window drags. If user drags the window then hide all the tooltips or * they will stay where they are until user hides them with the other commands. Aesthetics * only really. */ scene .getWindow() .xProperty() .addListener( (observable, oldValue, newValue) -> { for (Tooltip eraseTooltip : tooltipArrayList) { eraseTooltip.hide(); } }); scene .getWindow() .yProperty() .addListener( (observable, oldValue, newValue) -> { for (Tooltip eraseTooltip : tooltipArrayList) { eraseTooltip.hide(); } }); // System.out.println(event.getX()); // System.out.println(event.getY()); }); backBtn.setOnAction( event -> { Main.getPrimaryStage().setScene(StartingTownView.getStartingTownView()); mediaPlayer.stop(); for (Tooltip eraseTooltip : tooltipArrayList) { eraseTooltip.hide(); eraseTooltip = null; } }); setStartSaloon(scene); Main.getPrimaryStage().setScene(scene); }
public void setPubScene() { /** Done by Marco */ xPane.setStyle( "-fx-background-image: url(" + "\"" + Pub.getImage(Pub.getIndexById(this.id)) + "\"" + "); "); description = new StackPane(); events = new StackPane(); rating = new StackPane(); rating.setId("rating"); description.setId("description"); descriptionGrid.setId("description-text"); pubName = new Label("- " + Pub.getName(Pub.getIndexById(this.id)) + " -"); age = new Label(Pub.getAge(Pub.getIndexById(this.id)) + " years \uF000"); age.setId("infoLabel"); open = new Label(Pub.getOpening(Pub.getIndexById(this.id)) + " \uF017"); open.setId("infoLabel"); address = new Label(Pub.getAddress(Pub.getIndexById(this.id)) + " \uF124"); address.setId("infoLabel"); type = new Label(Pub.getType(Pub.getIndexById(this.id)) + " \uF005"); type.setId("infoLabel"); /** End of Marco's work */ /** Done by Aseel */ discountForStudents = new Label(Pub.getHasStudentDiscount(Pub.getIndexById(this.id)) + " \uF02D"); if (Pub.getHasStudentDiscount(Pub.getIndexById(this.id)) == 1) { discountForStudents = new Label("Discounts " + " \uF02D"); } else if (Pub.getHasStudentDiscount(Pub.getIndexById(this.id)) == 0) { discountForStudents = new Label("No Discounts " + "\uF02D"); } discountForStudents.setId("infoLabel"); entranceFees = new Label(Pub.getHasFee(Pub.getIndexById(this.id)) + "\uf153"); if (Pub.getHasFee(Pub.getIndexById(this.id)) == 1) { entranceFees = new Label("Fees " + " \uF153"); } else if (Pub.getHasFee(Pub.getIndexById(this.id)) == 0) { entranceFees = new Label("No Fees " + "\uF153"); } entranceFees.setId("infoLabel"); /** End of Aseel's work */ /** Done by Marco */ map.setMinWidth(1000); map.setMaxHeight(250); browser.load( "http://locateme.marcokoivisto.me/?lat=" + Pub.getLat(Pub.getIndexById(this.id)) + "&lon=" + Pub.getLon(Pub.getIndexById(this.id))); int nrStars = Pub.getNrStars(Pub.getIndexById(this.id)); String stars = ""; for (int i = 0; i < nrStars; i++) { stars += "\uF005 "; } rates = new Label(stars); rates.setId("ratingOfStars"); rating.getChildren().add(rates); rating.setAlignment(Pos.CENTER); xPane.add(pubName, 1, 1); descriptionGrid.add(discountForStudents, 1, 1); descriptionGrid.add(entranceFees, 2, 1); descriptionGrid.add(age, 3, 1); descriptionGrid.add(open, 4, 1); descriptionGrid.add(type, 5, 1); descriptionGrid.add(address, 6, 1); /** End of Marco's work */ /** Done by Marco */ descriptionGrid.setAlignment(Pos.CENTER); description.getChildren().addAll(descriptionGrid); eventDescriptionGrid.add(eventLabel, 1, 1); eventDescriptionGrid.add(eventPane, 1, 2); GridPane.setHalignment(eventLabel, HPos.CENTER); eventDescriptionGrid.setAlignment(Pos.CENTER); events.getChildren().addAll(eventDescriptionGrid); eventName = new Label(Pub.getEventName(Pub.getIndexById(this.id))); eventDescription = new Label(Pub.getEventDescription(Pub.getIndexById(this.id))); eventGrid.add(eventName, 1, 1); eventGrid.add(eventDescription, 1, 2); eventName.setId("eventName"); eventDescription.setId("eventDescription"); eventPane.getChildren().add(eventGrid); eventGrid.setId("event"); events.setId("eventField"); xPane.add(rating, 1, 2); xPane.add(description, 1, 3); xPane.add(map, 1, 4); if (Pub.getEventName(Pub.getIndexById(this.id)) != "") { xPane.add(events, 1, 5); } pubName.setId("pub_name"); GridPane.setHalignment(pubName, HPos.CENTER); GridPane.setValignment(pubName, VPos.TOP); GridPane.setValignment(back, VPos.TOP); GridPane.setHalignment(star, HPos.RIGHT); GridPane.setValignment(star, VPos.TOP); xPane.add(star, 1, 1); header.setFitWidth(1000); header.setPreserveRatio(true); /** End of Marco's work */ /** Done by Shafiq & Antonino */ int rate = PubDataAccessor.checkRate(this.id); star.setText(rate + " \uF08A"); /** End of Shafiq & Antonino's WORK */ }
/* 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 */ }
public entryView(Object object) { getChildren().clear(); getStylesheets().add("css/entryView.css"); giveNode(object); BorderPane mainpane = new BorderPane(); BorderPane centerpane = new BorderPane(); BorderPane bottompane = new BorderPane(); GridPane divgrid = new GridPane(); GridPane maingrid = new GridPane(); Label emptylab = new Label(); Label divlab = new Label(); VBox options = new VBox(); VBox tlist = new VBox(); Button ok = new Button("ok"); Periods periods = new Periods(); TList loadteacher = new TList(); DatePicker date = new DatePicker(); BorderPane datepane = new BorderPane(); BorderPane nextpane = new BorderPane(); Button next = new Button("next"); options.setId("options"); tlist.setId("tlist"); divgrid.setId("divgrid"); bottompane.setId("bottompane"); periods.setId("period"); divlab.setId("divlabel"); datepane.setId("datepane"); nextpane.setId("nextpane"); emptylab.setPrefHeight(100); bottompane.setStyle("-fx-background-color:#ecf0f1;"); StringConverter converter = new StringConverter<LocalDate>() { DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("dd-MM-yyyy"); @Override public String toString(LocalDate date) { if (date != null) { return dateFormatter.format(date); } else { return ""; } } @Override public LocalDate fromString(String string) { if (string != null && !string.isEmpty()) { return LocalDate.parse(string, dateFormatter); } else { return null; } } }; date.setConverter(converter); date.setPromptText("dd-MM-yyyy".toLowerCase()); date.setValue(LocalDate.now()); maingrid = div.loadDiv(); list = (ListView) div.takelist(); periods.period(); list.getSelectionModel().select(0); divlab.setText((String) list.getItems().get(0)); list.setOnMouseClicked( e -> { divlab.setText((String) list.getSelectionModel().getSelectedItem()); periods.getChildren().clear(); periods.period(); }); final Node node = maingrid.getChildren().get(0); Platform.runLater( new Runnable() { @Override public void run() { node.requestFocus(); } }); next.setOnAction( e -> { // list.getSelectionModel().getSelectedIndex()+1 list.getSelectionModel().select(list.getSelectionModel().getSelectedIndex() + 1); divlab.setText((String) list.getSelectionModel().getSelectedItem()); }); nextpane.setRight(next); datepane.setRight(date); options.getChildren().clear(); options.getChildren().add(maingrid); divgrid.setHgap(5); // divgrid.add(emptylab, 0, 1); divgrid.add(datepane, 1, 0); divgrid.add(divlab, 0, 2); divgrid.add(periods, 1, 2); divgrid.add(nextpane, 1, 3); divgrid.setAlignment(Pos.TOP_CENTER); mainpane.setCenter(centerpane); mainpane.setLeft(options); mainpane.setRight(loadteacher); centerpane.setCenter(divgrid); centerpane.setBottom(bottompane); bottompane.setRight(ok); addCloseButton cb = new addCloseButton(); cb.addxb(1); setTop(cb); setCenter(mainpane); }