// ******************** Constructors ************************************** public LcdSkin(Gauge gauge) { super(gauge); width = PREFERRED_WIDTH; height = PREFERRED_HEIGHT; valueOffsetLeft = 0.0; valueOffsetRight = 0.0; digitalFontSizeFactor = 1.0; backgroundTextBuilder = new StringBuilder(); valueFormatString = new StringBuilder("%.") .append(Integer.toString(gauge.getDecimals())) .append("f") .toString(); otherFormatString = new StringBuilder("%.") .append(Integer.toString(gauge.getTickLabelDecimals())) .append("f") .toString(); sections = gauge.getSections(); sectionColorMap = new HashMap<>(sections.size()); updateSectionColors(); FOREGROUND_SHADOW.setOffsetX(0); FOREGROUND_SHADOW.setOffsetY(1); FOREGROUND_SHADOW.setColor(Color.rgb(0, 0, 0, 0.5)); FOREGROUND_SHADOW.setBlurType(BlurType.TWO_PASS_BOX); FOREGROUND_SHADOW.setRadius(2); init(); initGraphics(); registerListeners(); }
@SuppressWarnings("unchecked") private void initComponents() { pane = new AnchorPane(); pane.setPrefSize(800, 600); pane.setStyle( "-fx-background-color: linear-gradient(from 0% 0% to 100% 100%, blue 0%, silver 100%);"); txPesquisa = new TextField(); DropShadow ds = new DropShadow(); ds.setSpread(0.5); ds.setColor(Color.web("#FF0000")); txPesquisa.setEffect(ds); txPesquisa.setPromptText("Digite o item para pesquisa"); txPesquisa.setPrefWidth(200); txPesquisa.setFocusTraversable(false); tbVitrine = new TableView<ItensProperty>(); initItens(); tbVitrine.setItems(listItens); tbVitrine.setPrefSize(780, 550); columnProduto = new TableColumn<ItensProperty, String>(); columnProduto.setCellValueFactory(new PropertyValueFactory<ItensProperty, String>("produto")); columnProduto.setText("Produto"); columnPreco = new TableColumn<ItensProperty, Double>(); columnPreco.setCellValueFactory(new PropertyValueFactory<ItensProperty, Double>("preco")); columnPreco.setText("Preço"); tbVitrine.getColumns().addAll(columnProduto, columnPreco); pane.getChildren().addAll(txPesquisa, tbVitrine); }
private void configureEffect() { handEffect.setOffsetX(radius / 40); handEffect.setOffsetY(radius / 40); handEffect.setRadius(6); handEffect.setColor(Color.web("#000000")); Lighting lighting = new Lighting(); Light.Distant light = new Light.Distant(); light.setAzimuth(225); lighting.setLight(light); handEffect.setInput(lighting); handEffectGroup.setEffect(handEffect); }
public MovieTile(Movie movie, Scene scene) { super(); this.movie = movie; HBox hbox = new HBox(2); // hbox.setPrefHeight(500); hbox.prefWidthProperty().bind(scene.widthProperty().divide(8)); // hbox.prefHeightProperty().bind(scene.heightProperty().divide(2)); ImageView imgView = new ImageView(); imgView.setImage(new Image("file:" + movie.title.getValue() + ".jpg")); imgView.fitWidthProperty().bind(hbox.widthProperty().divide(2)); // imgView.setPreserveRatio(true); imgView.setSmooth(true); DropShadow ds = new DropShadow(); ds.setRadius(10); ds.setOffsetX(-5); ds.setOffsetY(2); ds.setColor(Color.color(0, 0, 0, 0.3)); imgView.setEffect(ds); VBox vbox = new VBox(2); HBox titleBox = new HBox(2); Text nameField = new Text(); nameField.setTextOrigin(VPos.TOP); nameField.setStroke(Color.BLACK); nameField.textProperty().bind(movie.title); Text dateField = new Text(); dateField.setTextOrigin(VPos.TOP); dateField.setStroke(Color.GRAY); dateField .textProperty() .bind(new SimpleStringProperty(" (").concat(movie.releaseDate).concat(")")); titleBox.getChildren().addAll(nameField, dateField); Text genreField = new Text(); // genreField.prefHeightProperty().bind(hbox.heightProperty().divide(5/1)); genreField.textProperty().bind(movie.genre); TextField comField = new TextField(); // comField.prefHeightProperty().bind(hbox.heightProperty().divide(5/2)); comField.textProperty().bind(movie.comments); vbox.getChildren().addAll(titleBox, genreField, comField); VBox.setVgrow(comField, Priority.ALWAYS); hbox.getChildren().addAll(imgView, vbox); this.getChildren().addAll(hbox); }
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"); }
// ******************** Drawing related *********************************** public final void drawLed() { final double SIZE = control.getPrefWidth() < control.getPrefHeight() ? control.getPrefWidth() : control.getPrefHeight(); final double WIDTH = SIZE; final double HEIGHT = SIZE; led.setStyle("-fx-led: " + Util.colorToCssColor(control.getColor())); final Shape IBOUNDS = new Rectangle(0, 0, WIDTH, HEIGHT); IBOUNDS.setOpacity(0.0); final Shape LED_FRAME; final Shape LED_OFF; final Shape HIGHLIGHT; switch (control.getType()) { case SQUARE: LED_FRAME = new Rectangle(0.0625 * WIDTH, 0.0625 * HEIGHT, 0.875 * WIDTH, 0.875 * HEIGHT); LED_OFF = new Rectangle(0.1875 * WIDTH, 0.1875 * HEIGHT, 0.625 * WIDTH, 0.625 * HEIGHT); ledOn = new Rectangle(0.1875 * WIDTH, 0.1875 * HEIGHT, 0.625 * WIDTH, 0.625 * HEIGHT); HIGHLIGHT = new Rectangle(0.25 * WIDTH, 0.25 * HEIGHT, 0.5 * WIDTH, 0.1875 * HEIGHT); break; case VERTICAL: LED_FRAME = new Rectangle(0.25 * WIDTH, 0.0625 * HEIGHT, 0.5 * WIDTH, 0.875 * HEIGHT); LED_OFF = new Rectangle(0.3125 * WIDTH, 0.125 * HEIGHT, 0.375 * WIDTH, 0.75 * HEIGHT); ledOn = new Rectangle(0.3125 * WIDTH, 0.125 * HEIGHT, 0.375 * WIDTH, 0.75 * HEIGHT); HIGHLIGHT = new Rectangle(0.3125 * WIDTH, 0.125 * HEIGHT, 0.375 * WIDTH, 0.375 * HEIGHT); break; case HORIZONTAL: LED_FRAME = new Rectangle(0.0625 * WIDTH, 0.25 * HEIGHT, 0.875 * WIDTH, 0.5 * HEIGHT); LED_OFF = new Rectangle(0.125 * WIDTH, 0.3125 * HEIGHT, 0.75 * WIDTH, 0.375 * HEIGHT); ledOn = new Rectangle(0.125 * WIDTH, 0.3125 * HEIGHT, 0.75 * WIDTH, 0.375 * HEIGHT); HIGHLIGHT = new Rectangle(0.125 * WIDTH, 0.3125 * HEIGHT, 0.75 * WIDTH, 0.1875 * HEIGHT); break; case ROUND: default: LED_FRAME = new Circle(0.5 * WIDTH, 0.5 * HEIGHT, 0.4375 * WIDTH); LED_OFF = new Circle(0.5 * WIDTH, 0.5 * HEIGHT, 0.3125 * WIDTH); ledOn = new Circle(0.5 * WIDTH, 0.5 * HEIGHT, 0.3125 * WIDTH); HIGHLIGHT = new Circle(0.5 * WIDTH, 0.5 * HEIGHT, 0.2 * WIDTH); break; } LED_FRAME.getStyleClass().add("frame"); LED_OFF.getStyleClass().clear(); LED_OFF.getStyleClass().add("off"); LED_OFF.setStyle("-fx-led: " + Util.colorToCssColor(control.getColor())); ledOn.getStyleClass().clear(); ledOn.getStyleClass().add("on"); ledOn.setStyle("-fx-led: " + Util.colorToCssColor(control.getColor())); ledOn.setVisible(control.isOn()); HIGHLIGHT.getStyleClass().add("highlight"); if (LED_FRAME.visibleProperty().isBound()) { LED_FRAME.visibleProperty().unbind(); } LED_FRAME.visibleProperty().bind(control.frameVisibleProperty()); final InnerShadow INNER_SHADOW = new InnerShadow(); INNER_SHADOW.setWidth(0.180 * SIZE); INNER_SHADOW.setHeight(0.180 * SIZE); INNER_SHADOW.setRadius(0.15 * SIZE); INNER_SHADOW.setColor(Color.BLACK); INNER_SHADOW.setBlurType(BlurType.GAUSSIAN); LED_OFF.setEffect(INNER_SHADOW); final DropShadow GLOW = new DropShadow(); GLOW.setSpread(0.35); GLOW.setRadius(0.16 * ledOn.getLayoutBounds().getWidth()); GLOW.setColor(control.getColor()); GLOW.setBlurType(BlurType.GAUSSIAN); GLOW.setInput(INNER_SHADOW); ledOn.setEffect(GLOW); led.getChildren().setAll(IBOUNDS, LED_FRAME, LED_OFF, ledOn, HIGHLIGHT); led.setCache(true); }