@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);
 }
示例#2
0
  // ******************** 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);
  }