private void setCaracteristicasAlContenedorPrincipal() { Button botonJuegosExistentes = new Button("Juegos existentes"); botonJuegosExistentes.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); botonJuegosExistentes.setTextFill(Color.WHITE); BackgroundFill fondoDeColorJuegosExistentes = new BackgroundFill(Color.RED, new CornerRadii(5), new Insets(0.0, 0.0, 0.0, 0.0)); botonJuegosExistentes.setBackground(new Background(fondoDeColorJuegosExistentes)); botonJuegosExistentes.setOnMouseEntered( e -> { botonJuegosExistentes.setScaleX(1.3); botonJuegosExistentes.setScaleY(1.3); }); botonJuegosExistentes.setOnMouseExited( e -> { botonJuegosExistentes.setScaleX(1); botonJuegosExistentes.setScaleY(1); }); botonJuegosExistentes.setOnAction( e -> { VistaJuegosExistentes nuevaVista = new VistaJuegosExistentes(this); nuevaVista.mostrar(); }); Button botonNuevoJuego = new Button("Nuevo juego"); botonNuevoJuego.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); botonNuevoJuego.setTextFill(Color.WHITE); BackgroundFill fondoDeColorNuevoJuego = new BackgroundFill(Color.RED, new CornerRadii(5), new Insets(0.0, 0.0, 0.0, 0.0)); botonNuevoJuego.setBackground(new Background(fondoDeColorNuevoJuego)); botonNuevoJuego.setOnMouseEntered( e -> { botonNuevoJuego.setScaleX(1.3); botonNuevoJuego.setScaleY(1.3); }); botonNuevoJuego.setOnMouseExited( e -> { botonNuevoJuego.setScaleX(1); botonNuevoJuego.setScaleY(1); }); botonNuevoJuego.setOnAction( e -> { VistaEleccionVarianteFlor nuevaVista = new VistaEleccionVarianteFlor(this); nuevaVista.mostrar(); }); this.contenedor.getChildren().addAll(botonJuegosExistentes, botonNuevoJuego); }
private void createFirebugButton() { firebugButton = new Button(FontAwesome.ICON_BUG); firebugButton.setFont(Font.font("FontAwesome", 14)); firebugButton.setTextFill(Color.RED); firebugButton.setTooltip(new Tooltip("Launch Firebug.")); firebugButton.disableProperty().bind(webEngine.getLoadWorker().runningProperty()); firebugButton.setOnAction(observable -> webEngine.executeScript(firebugScript)); }
@Override public void start(Stage primaryStage) { // Text Button Button btnText = new Button(); btnText.setText("Button!"); btnText.setTextFill(Color.web("red")); btnText.setFont(new Font("Verdana", 15)); // Image Text Button Button btnTextImage = new Button(); btnTextImage.setText("Check"); btnTextImage.setFont(Font.font(20)); btnTextImage.setPrefSize(150, 100); Image imgCheck = new Image("file:resources/images/check.png"); btnTextImage.setGraphic(new ImageView(imgCheck)); // Image Button Button btnRight = new Button(); Image imgRight = new Image("file:resources/images/button_right.png"); btnRight.setGraphic(new ImageView(imgRight)); Button btnLeft = new Button(); Image imgLeft = new Image("file:resources/images/button_left.png"); btnLeft.setGraphic(new ImageView(imgLeft)); HBox hBoxFirst = new HBox(25); hBoxFirst.getChildren().addAll(btnText, btnTextImage); HBox hBoxSecond = new HBox(10); hBoxSecond.getChildren().addAll(btnLeft, btnRight); VBox vBox = new VBox(20); vBox.getChildren().addAll(hBoxFirst, hBoxSecond); vBox.setPadding(new Insets(20, 20, 20, 20)); StackPane layout = new StackPane(vBox); Scene scene = new Scene(layout, 300, 180); primaryStage.setTitle("Sample 03. Button"); primaryStage.setScene(scene); primaryStage.show(); }
public SerieInfo(final Serie serie) { // TODO Auto-generated constructor stub GridPane grid = new GridPane(); FlowPane flow = new FlowPane(Orientation.HORIZONTAL); flow.setAlignment(Pos.TOP_LEFT); flow.setHgap(40); DropShadow dropShadow = new DropShadow(); dropShadow.setOffsetX(10); dropShadow.setOffsetY(10); dropShadow.setColor(Color.rgb(50, 50, 50, 0.7)); Label poster = new Label(); String style_inner = "-fx-font: Gill Sans;" + "-fx-font-family: Gill Sans;" + "-fx-effect: dropshadow(one-pass-box, black, 8, 0, 4, 4);"; poster.setStyle(style_inner); final Label star = new Label(); Image stella = new Image("img/greentick.png", 35, 35, true, true, true); star.setGraphic(new ImageView(stella)); star.setVisible(false); ImageView image = new ImageView(serie.getPoster()); poster.setGraphic(image); TextArea text = new TextArea(); text.setPrefSize(600, 160); text.setText(serie.getOverview()); text.setWrapText(true); text.setEditable(false); /* * text.setStyle("-fx-text-fill: black;"+ "-fx-font: Gill Sans;"+ * "-fx-font-size: 13;" + "-fx-height:400"); */ text.setStyle(LABEL_STYLE); String name = null; if (serie.getNome().length() > 16) { name = serie.getNome().substring(0, 15); name = name.concat("..."); } else { name = serie.getNome(); } Label nome = new Label(name); nome.setTextFill(Color.BLACK); nome.setFont(Font.font("Helvetica", 28)); final Button btn = new Button(" Add "); ImageView imageview = new ImageView(new Image("img/add.png", 12, 12, true, true, true)); btn.setGraphic(imageview); btn.setContentDisplay(ContentDisplay.LEFT); /* * String buttonCss = SerieInfo.class.getResource("CustomButton.css") * .toExternalForm(); btn.getStylesheets().add(buttonCss); */ btn.getStyleClass().add("custom-browse"); btn.setCursor(Cursor.HAND); btn.setTextFill(Color.WHITE); btn.addEventHandler( MouseEvent.MOUSE_CLICKED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent e) { star.setVisible(true); if (Preferiti.getInstance().addToPreferiti(serie) == false) { /* * new MyDialog(Guiseries2.stage, * Modality.APPLICATION_MODAL, "Warning!", serie); */ } else { btn.setDisable(true); btn.setText(" Added "); btn.setGraphic(null); // torrent... DaemonManager manager = new DaemonManager(); Search search = new Search( serie, manager, "ENG", new SearchListener() { @Override public void SearchListener() { Platform.runLater( new Runnable() { @Override public void run() { boolean compare = false; for (int i = 0; i < serie.getStagioni().size(); i++) { for (int j = 0; j < serie.getStagioni().get(i).getEpisodiStagione().size(); j++) { compare = false; if ((serie .getStagioni() .get(i) .getEpisodiStagione() .get(j) .getTorrent() != null)) { for (int k = (1 + j); k < serie .getStagioni() .get(i) .getEpisodiStagione() .size(); k++) { if (serie .getStagioni() .get(i) .getEpisodiStagione() .get(k) .getTorrent() != null) { if (serie .getStagioni() .get(i) .getEpisodiStagione() .get(j) .getTorrent() .getName() .equals( serie .getStagioni() .get(i) .getEpisodiStagione() .get(k) .getTorrent() .getName())) { compare = true; } } } if (compare == false) { TorrentSeriesElement.getInstance() .addToTorrents( serie .getStagioni() .get(i) .getEpisodiStagione() .get(j) .getTorrent()); if ((TorrentSeriesElement.getInstance() .torrents .indexOf( serie .getStagioni() .get(i) .getEpisodiStagione() .get(j) .getTorrent()) % 2) == 0) { TabDownload.mainDownload .getChildren() .add( TabDownload.addTorrentEvenToDownloadTab( serie .getStagioni() .get(i) .getEpisodiStagione() .get(j) .getTorrent())); } else { TabDownload.mainDownload .getChildren() .add( TabDownload.addTorrentOddToDownloadTab( serie .getStagioni() .get(i) .getEpisodiStagione() .get(j) .getTorrent())); } System.out.println( serie .getStagioni() .get(i) .getEpisodiStagione() .get(j) .getTorrent() .getName()); } } } } try { FilmistaDb.getInstance().addSeriesToFilmistaDb(serie); } catch (ClassNotFoundException e1) { // TODO Auto-generated // catch // block e1.printStackTrace(); } catch (IOException e1) { // TODO Auto-generated // catch // block e1.printStackTrace(); } catch (SQLException e1) { // TODO Auto-generated // catch // block e1.printStackTrace(); } TabPreferiti.updateTab(); } }); } }); } } }); flow.getChildren().add(btn); flow.getChildren().add(nome); if (Preferiti.getInstance().series.contains(serie) == true) { btn.setText(" Added "); btn.setDisable(true); star.setVisible(true); btn.setGraphic(null); } grid.setHgap(25); grid.setVgap(15); grid.add(poster, 0, 0, 1, 2); grid.add(flow, 1, 0); FlowPane paneStar = new FlowPane(Orientation.HORIZONTAL); paneStar.setAlignment(Pos.TOP_RIGHT); paneStar.getChildren().add(star); grid.add(paneStar, 2, 0, 1, 1); grid.add(text, 1, 1, 2, 1); grid.getColumnConstraints().add(0, new ColumnConstraints()); grid.getColumnConstraints().add(1, new ColumnConstraints()); grid.getColumnConstraints().add(2, new ColumnConstraints(150)); // grid.setGridLinesVisible(true); grid.setHgrow(text, Priority.ALWAYS); grid.setVgrow(poster, Priority.ALWAYS); grid.setPadding(new Insets(25, 25, 25, 25)); this.setCenter(grid); String customCss = SerieInfo.class.getResource("CustomBorder.css").toExternalForm(); this.getStylesheets().add(customCss); this.getStyleClass().add("custom-border"); }
/** Initializes the controller class. */ @FXML private void handleButtonAction(ActionEvent event) throws IOException { if (event.getSource() instanceof TextField) { TextField text = (TextField) event.getSource(); String name = text.getText(); Player4.setName(name); } Button b = (Button) event.getSource(); String id = b.getId(); Stage stage; Parent root = FXMLLoader.load(getClass().getResource("Person4.fxml")); if (id.equals("flapper")) { flapper = b; flapper.setTextFill(Color.RED); humanoid.setTextFill(Color.BLACK); spheroid.setTextFill(Color.BLACK); mechtron.setTextFill(Color.BLACK); } else if (id.equals("humanoid")) { humanoid = b; flapper.setTextFill(Color.BLACK); humanoid.setTextFill(Color.RED); spheroid.setTextFill(Color.BLACK); mechtron.setTextFill(Color.BLACK); } else if (id.equals("spheroid")) { spheroid = b; flapper.setTextFill(Color.BLACK); humanoid.setTextFill(Color.BLACK); spheroid.setTextFill(Color.RED); mechtron.setTextFill(Color.BLACK); } else if (id.equals("mechtron")) { mechtron = b; flapper.setTextFill(Color.BLACK); humanoid.setTextFill(Color.BLACK); spheroid.setTextFill(Color.BLACK); mechtron.setTextFill(Color.RED); } if (id.equals("bRed")) { bRed = b; bRed.setTextFill(Color.RED); bBlue.setTextFill(Color.BLACK); bGreen.setTextFill(Color.BLACK); bOrange.setTextFill(Color.BLACK); } else if (id.equals("bBlue")) { bBlue = b; bRed.setTextFill(Color.BLACK); bBlue.setTextFill(Color.RED); bGreen.setTextFill(Color.BLACK); bOrange.setTextFill(Color.BLACK); } else if (id.equals("bGreen")) { bGreen = b; bRed.setTextFill(Color.BLACK); bBlue.setTextFill(Color.BLACK); bGreen.setTextFill(Color.RED); bOrange.setTextFill(Color.BLACK); } else if (id.equals("bOrange")) { bOrange = b; bRed.setTextFill(Color.BLACK); bBlue.setTextFill(Color.BLACK); bGreen.setTextFill(Color.BLACK); bOrange.setTextFill(Color.RED); } if (event.getSource() == startGame) { stage = (Stage) startGame.getScene().getWindow(); root = FXMLLoader.load(getClass().getResource("GameStart.fxml")); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); System.out.println("Player 1 pick land"); } if (Arrays.asList(Player4.races).contains(b.getText())) { Player4.setRace(b.getText()); } if (Arrays.asList(Player4.colors).contains(b.getText())) { Player4.setColor(b.getText()); } }