Beispiel #1
0
  @Override
  public void update(Node node) {
    DelaunayTriangle triangle = ((NavMesh) searchSpace).getTriangle(node);

    Color cstate = NodeState.color(node.state);
    Color cstatus = NodeStatus.color(node.status);

    Color c = cstate.interpolate(cstatus, 0.5);

    double b = 0.7;
    // c = c.deriveColor(0, 1, b, 1);

    c = Color.WHITESMOKE;

    if (node.equals(goal.get())) c = Color.ORANGERED;
    else if (node.equals(start.get())) c = Color.LIMEGREEN;

    Vertex[] points = new Vertex[3];

    double[] xPoints = new double[3];
    double[] yPoints = new double[3];
    for (int i = 0; i < triangle.points.length; i++) {
      xPoints[i] = triangle.points[i].getX() / scaleFactor;
      yPoints[i] = triangle.points[i].getY() / scaleFactor;
    }

    canvas.drawTriangle(xPoints, yPoints, c);
  }
  // REMOVE ME
  public static Node createIconContent() {
    StackPane sp = new StackPane();
    BorderPane borderPane = new BorderPane();

    Rectangle rectangle = new Rectangle(62, 62, Color.LIGHTGREY);
    rectangle.setStroke(Color.BLACK);
    borderPane.setPrefSize(rectangle.getWidth(), rectangle.getHeight());

    Rectangle recTop = new Rectangle(62, 5, Color.web("#349b00"));
    recTop.setStroke(Color.BLACK);
    Rectangle recBottom = new Rectangle(62, 14, Color.web("#349b00"));
    recBottom.setStroke(Color.BLACK);
    Rectangle recLeft = new Rectangle(20, 41, Color.TRANSPARENT);
    recLeft.setStroke(Color.BLACK);
    Rectangle recRight = new Rectangle(20, 41, Color.TRANSPARENT);
    recRight.setStroke(Color.BLACK);
    Rectangle centerRight = new Rectangle(20, 41, Color.TRANSPARENT);
    centerRight.setStroke(Color.BLACK);
    borderPane.setRight(recRight);
    borderPane.setTop(recTop);
    borderPane.setLeft(recLeft);
    borderPane.setBottom(recBottom);
    borderPane.setCenter(centerRight);

    sp.getChildren().addAll(rectangle, borderPane);
    return new Group(sp);
  }
Beispiel #3
0
  private void showContextMenu(double x, double y) {
    if (contextMenu != null && contextMenu.isShowing()) contextMenu.hide();
    contextMenu = new ContextMenu();
    // contextMenu.getStyleClass().add("background");

    Color bg = cfg.colorProperty().getValue();
    Color fg = bg.getBrightness() < 0.5f ? Color.WHITE : Color.BLACK;

    contextMenu.setStyle(background(bg, true));

    contextMenu.setOnHidden(
        value -> {
          if (cfg.autoHideProperty().get() && !arePopupsOpen()) maybeHideDock();
        });
    if (!cfg.autoHideProperty().get()) {
      MenuItem hide = new MenuItem(resources.getString("menu.hide"));
      hide.setOnAction(value -> getStage().setIconified(true));
      hide.setStyle(textFill(fg));
      contextMenu.getItems().add(hide);
    }
    MenuItem close = new MenuItem(resources.getString("menu.exit"));
    close.setOnAction(
        value -> {
          context.confirmExit();
          maybeHideDock();
        });
    close.setStyle(textFill(fg));
    contextMenu.getItems().add(close);
    Point2D loc = new Point2D(x + getStage().getX(), y + getStage().getY());
    contextMenu.show(dockContent, loc.getX(), loc.getY());
  }
Beispiel #4
0
 @Override
 public void encode(DataOutputStream os, Color c) throws IOException {
   os.writeDouble(c.getRed());
   os.writeDouble(c.getGreen());
   os.writeDouble(c.getBlue());
   os.writeDouble(c.getOpacity());
 }
 private void rebuild() {
   // update indeterminate indicator
   final int segments = skin.indeterminateSegmentCount.get();
   opacities.clear();
   pathsG.getChildren().clear();
   final double step = 0.8 / (segments - 1);
   for (int i = 0; i < segments; i++) {
     Region region = new Region();
     region.setScaleShape(false);
     region.setCenterShape(false);
     region.getStyleClass().addAll("segment", "segment" + i);
     if (fillOverride instanceof Color) {
       Color c = (Color) fillOverride;
       region.setStyle(
           "-fx-background-color: rgba("
               + ((int) (255 * c.getRed()))
               + ","
               + ""
               + ((int) (255 * c.getGreen()))
               + ","
               + ((int) (255 * c.getBlue()))
               + ","
               + ""
               + c.getOpacity()
               + ");");
     } else {
       region.setStyle(null);
     }
     double opacity = Math.min(1, i * step);
     opacities.add(opacity);
     region.setOpacity(opacity);
     pathsG.getChildren().add(region);
   }
 }
Beispiel #6
0
 protected Color newColor(Color aBaseColor) {
   Color res = aBaseColor;
   Integer rnd = NGRandomGenerator.GlobalRandomGenerator.getInteger(0, 2);
   if (rnd == 0) res = aBaseColor.darker();
   else if (rnd == 2) res = aBaseColor.brighter();
   return res;
 }
Beispiel #7
0
  private void init(double firingRadius, double templateWidth) {
    double x0 = templateWidth / 2.0;
    double y0 = -templateWidth / 2.0;

    double x5 = templateWidth / 2.0;
    double y5 = templateWidth / 2.0;

    double x1 = x0 + firingRadius * Math.cos(45.0 / 180.0 * Math.PI);
    double y1 = y0 - firingRadius * Math.sin(45.0 / 180.0 * Math.PI);

    double x2 = x0 + firingRadius;
    double y2 = y0;

    double x3 = x5 + firingRadius;
    double y3 = y5;

    double x4 = x5 + firingRadius * Math.cos(45.0 / 180.0 * Math.PI);
    double y4 = y5 + firingRadius * Math.sin(45.0 / 180.0 * Math.PI);

    this.getElements().add(new MoveTo(x0, y0));
    this.getElements().add(new LineTo(x1, y1));
    this.getElements().add(new ArcTo(firingRadius, firingRadius, 45, x2, y2, false, true));
    this.getElements().add(new LineTo(x3, y3));
    this.getElements().add(new ArcTo(firingRadius, firingRadius, 45, x4, y4, false, true));
    this.getElements().add(new LineTo(x5, y5));
    this.getElements().add(new LineTo(x0, y0));
    this.setFill(Color.rgb(255, 0, 0, 0.35));
    this.setStroke(Color.rgb(255, 0, 0, 0.5));
    this.setFillRule(FillRule.NON_ZERO);
  }
  private static SubScene createSubScene(
      String title, Node node, Paint fillPaint, Camera camera, boolean msaa) {
    Group root = new Group();

    PointLight light = new PointLight(Color.WHITE);
    light.setTranslateX(50);
    light.setTranslateY(-300);
    light.setTranslateZ(-400);
    PointLight light2 = new PointLight(Color.color(0.6, 0.3, 0.4));
    light2.setTranslateX(400);
    light2.setTranslateY(0);
    light2.setTranslateZ(-400);

    AmbientLight ambientLight = new AmbientLight(Color.color(0.2, 0.2, 0.2));
    node.setRotationAxis(new Point3D(2, 1, 0).normalize());
    node.setTranslateX(180);
    node.setTranslateY(180);
    root.getChildren().addAll(setTitle(title), ambientLight, light, light2, node);

    SubScene subScene =
        new SubScene(
            root, 500, 400, true, msaa ? SceneAntialiasing.BALANCED : SceneAntialiasing.DISABLED);
    subScene.setFill(fillPaint);
    subScene.setCamera(camera);

    return subScene;
  }
 public static Sphere createSphere(Color c) {
   Sphere sphere = new Sphere(80);
   final PhongMaterial phongMaterial = new PhongMaterial();
   phongMaterial.setDiffuseColor(c.darker());
   phongMaterial.setSpecularColor(c.brighter());
   sphere.setMaterial(phongMaterial);
   return sphere;
 }
 public static Cylinder createCylinder(Color c) {
   Cylinder cylinder = new Cylinder(20, 180);
   final PhongMaterial phongMaterial = new PhongMaterial();
   phongMaterial.setDiffuseColor(c.darker());
   phongMaterial.setSpecularColor(c.brighter());
   cylinder.setMaterial(phongMaterial);
   return cylinder;
 }
Beispiel #11
0
  @Override
  public void init() {
    bigGauge =
        GaugeBuilder.create()
            .foregroundBaseColor(Color.WHITE)
            .prefSize(400, 400)
            .startAngle(270)
            .angleRange(270)
            .minValue(100)
            .maxValue(1000)
            .tickLabelLocation(TickLabelLocation.OUTSIDE)
            .tickLabelOrientation(TickLabelOrientation.ORTHOGONAL)
            .minorTickMarksVisible(false)
            .majorTickMarkType(TickMarkType.BOX)
            .valueVisible(false)
            .knobType(KnobType.FLAT)
            .needleShape(NeedleShape.FLAT)
            .needleColor(Color.WHITE)
            .sectionsVisible(true)
            .sections(
                new Section(100, 450, Color.rgb(60, 130, 145, 0.7)),
                new Section(650, 1000, Color.rgb(200, 100, 0, 0.7)))
            .animated(true)
            .build();
    smallGauge =
        GaugeBuilder.create()
            .prefSize(170, 170)
            .foregroundBaseColor(Color.WHITE)
            .minValue(0)
            .maxValue(10)
            .minorTickMarksVisible(false)
            .mediumTickMarkType(TickMarkType.DOT)
            .majorTickMarkType(TickMarkType.BOX)
            .tickLabelOrientation(TickLabelOrientation.ORTHOGONAL)
            .knobType(KnobType.FLAT)
            .needleShape(NeedleShape.FLAT)
            .needleColor(Color.WHITE)
            .valueVisible(false)
            .customTickLabelsEnabled(true)
            .customTickLabels("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
            .customTickLabelFontSize(28)
            .animated(true)
            .build();

    lastTimerCall = System.nanoTime();
    timer =
        new AnimationTimer() {
          @Override
          public void handle(long now) {
            if (now > lastTimerCall + 3_000_000_000l) {
              bigGauge.setValue(RND.nextDouble() * 900 + 100);
              smallGauge.setValue(RND.nextDouble() * 10);
              lastTimerCall = now;
            }
          }
        };
  }
 @FXML
 public void setRoleRogue() throws RemoteException {
   lbGameHunter.setTextFill(Color.web("#32cd32"));
   lbGameWarrior.setTextFill(Color.web("#32cd32"));
   lbGameMage.setTextFill(Color.web("#32cd32"));
   lbGameRogue.setTextFill(Color.web("#FFFFFF"));
   roleID = 0;
   setRole();
 }
 private String formatWebColor(Color c) {
   String r = Integer.toHexString((int) (c.getRed() * 255));
   if (r.length() == 1) r = "0" + r;
   String g = Integer.toHexString((int) (c.getGreen() * 255));
   if (g.length() == 1) g = "0" + g;
   String b = Integer.toHexString((int) (c.getBlue() * 255));
   if (b.length() == 1) b = "0" + b;
   return "#" + r + g + b;
 }
Beispiel #14
0
  @Override
  public void start(Stage primaryStage) throws Exception {
    Group root = new Group();
    Group circles = new Group();
    for (int i = 0; i < 30; i++) {
      Circle circle = new Circle(150, Color.web("white", 0.05));
      circle.setStrokeType(StrokeType.OUTSIDE);
      circle.setStroke(Color.web("white", 0.16));
      circle.setStrokeWidth(4);
      circles.getChildren().add(circle);
    }
    root.getChildren().add(circles);
    Scene scene = new Scene(root, 800, 600, Color.BLACK);
    Rectangle colors =
        new Rectangle(
            scene.getWidth(),
            scene.getHeight(),
            new LinearGradient(
                0f,
                1f,
                1f,
                0f,
                true,
                CycleMethod.NO_CYCLE,
                new Stop[] {
                  new Stop(0, Color.web("#f8bd55")),
                  new Stop(0.14, Color.web("#c0fe56")),
                  new Stop(0.28, Color.web("#5dfbc1")),
                  new Stop(0.43, Color.web("#64c2f8")),
                  new Stop(0.57, Color.web("#be4af7")),
                  new Stop(0.71, Color.web("#ed5fc2")),
                  new Stop(0.85, Color.web("#ef504c")),
                  new Stop(1, Color.web("#f2660f")),
                }));
    colors.widthProperty().bind(scene.widthProperty());
    colors.heightProperty().bind(scene.heightProperty());
    root.getChildren().add(colors);

    Timeline timeline = new Timeline();
    for (Node circle : circles.getChildren()) {
      timeline
          .getKeyFrames()
          .addAll(
              new KeyFrame(
                  Duration.ZERO, // set start position at 0
                  new KeyValue(circle.translateXProperty(), random() * 800),
                  new KeyValue(circle.translateYProperty(), random() * 600)),
              new KeyFrame(
                  new Duration(40000), // set end position at 40s
                  new KeyValue(circle.translateXProperty(), random() * 800),
                  new KeyValue(circle.translateYProperty(), random() * 600)));
    }
    timeline.play();
    primaryStage.setScene(scene);
    primaryStage.show();
  }
Beispiel #15
0
 public static Color getDefaultBaseColor(final String theme) {
   switch (theme) {
     case Application.STYLESHEET_CASPIAN:
       return Color.web(DEFAULT_CASPIAN_BASE_COLOR);
     case Application.STYLESHEET_MODENA:
       return Color.web(DEFAULT_MODENA_BASE_COLOR);
     default:
       return Color.web(DEFAULT_MODENA_BASE_COLOR);
   }
 }
Beispiel #16
0
  public void write(DataOutputStream dis) throws IOException {
    dis.writeDouble(X1);
    dis.writeDouble(Y1);
    dis.writeDouble(X2);
    dis.writeDouble(Y2);

    dis.writeDouble(color.getRed());
    dis.writeDouble(color.getGreen());
    dis.writeDouble(color.getBlue());
  }
  /**
   * Update background, tick and gridline colors
   *
   * @param cfg cfg[0] Background, cfg[1] Chart background, cfg[2] y cfg[3] gridline
   */
  public void updateChartColors(String[] cfg) {
    strBackgroundColor = cfg[0];
    for (Node le : legendFrame.getChildren()) {
      if (le instanceof LegendAxis) {
        le.setStyle("-fx-background-color:" + strBackgroundColor);
        ((LegendAxis) le).selected = false;
      }
    }
    chart.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor)));
    chartPanel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(4, 4, 4, 4),
            BorderFactory.createLineBorder(
                scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor)))));
    chartPanel.setBackground(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor)));

    legendFrame.setStyle("marco: " + strBackgroundColor + ";-fx-background-color: marco;");

    strChartBackgroundColor = cfg[1];
    ;
    plot.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strChartBackgroundColor)));

    for (Node le : legendFrame.getChildren()) {
      if (le instanceof LegendAxis) {
        le.setStyle("-fx-background-color:" + strBackgroundColor);
        ((LegendAxis) le).selected = false;
        for (Node nn : ((LegendAxis) le).getChildren()) {
          if (nn instanceof Label) {
            ((Label) nn)
                .setStyle(
                    "fondo: "
                        + strChartBackgroundColor
                        + ";-fx-background-color: fondo;-fx-text-fill: ladder(fondo, white 49%, black 50%);-fx-padding:5px;-fx-background-radius: 5;-fx-font-size: "
                        + String.valueOf(fontSize)
                        + "px");
          }
        }
      }
    }

    strGridlineColor = cfg[2];
    ;
    plot.setDomainGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor)));
    plot.setRangeGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor)));

    strTickColor = cfg[3];
    ;
    abcissaAxis.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
    abcissaAxis.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
    for (NumberAxis ejeOrdenada : AxesList) {
      ejeOrdenada.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
      ejeOrdenada.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
    }
  }
Beispiel #18
0
  public void notify(String msg, int type, Action... actions) {
    Pos pos = Pos.CENTER;
    if (cfg.topProperty().get()) {
      pos = Pos.TOP_LEFT;
    } else if (cfg.bottomProperty().get()) {
      pos = Pos.BOTTOM_LEFT;
    } else if (cfg.leftProperty().get()) {
      pos = Pos.TOP_RIGHT;
    } else if (cfg.rightProperty().get()) {
      pos = Pos.TOP_LEFT;
    }

    Notifications notificationBuilder =
        Notifications.create()
            .text(msg)
            .hideAfter(Duration.seconds(10))
            .position(pos)
            .onAction(
                new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent arg0) {}
                });

    notificationBuilder.hideCloseButton();
    notificationBuilder.action(actions);

    Configuration cfg = Configuration.getDefault();
    Color backgroundColour = cfg.colorProperty().getValue();
    if (backgroundColour.getBrightness() < 0.5) {
      notificationBuilder.darkStyle();
    }

    // if (darkStyleChkBox.isSelected()) {
    // notificationBuilder.darkStyle();
    // }

    switch (type) {
      case GUICallback.NOTIFY_WARNING:
        notificationBuilder.showWarning();
        break;
      case GUICallback.NOTIFY_INFO:
        notificationBuilder.showInformation();
        break;
      case GUICallback.NOTIFY_CONNECT:
      case GUICallback.NOTIFY_DISCONNECT:
        notificationBuilder.showConfirm();
        break;
      case GUICallback.NOTIFY_ERROR:
        notificationBuilder.showError();
        break;
      default:
        notificationBuilder.show();
    }
  }
 public static String encodeColorToRGBA(Color color) {
   final String result;
   if (color == null) {
     result = "null"; // NOI18N
   } else {
     final int red = (int) (color.getRed() * 255);
     final int green = (int) (color.getGreen() * 255);
     final int blue = (int) (color.getBlue() * 255);
     result = "rgba(" + red + "," + green + "," + blue + "," + color.getOpacity() + ")"; // NOI18N
   }
   return result;
 }
        @Override
        protected void invalidated() {

          if (!changeIsLocal) {
            changeIsLocal = true;
            final Color c = get();
            hue.set(c.getHue());
            sat.set(c.getSaturation() * 100);
            bright.set(c.getBrightness() * 100);
            changeIsLocal = false;
          }
        }
Beispiel #21
0
  /*
   * initialize lights used in this app
   */
  private void lightSetting() {
    // Creating Ambient Light
    AmbientLight ambient = new AmbientLight();
    ambient.setColor(Color.rgb(0, 255, 0, 0.6));
    // Creating Point Light
    PointLight point = new PointLight();
    point.setColor(Color.rgb(255, 255, 255, 1));
    point.setLayoutX(400);
    point.setLayoutY(100);
    point.setTranslateZ(-1100);

    root.getChildren().addAll(ambient, point);
  }
    private void configureDesign() {
      rectangleVisual.setLayoutY(0f);
      rectangleVisual.setLayoutX(-14);
      rectangleVisual.setFill(Color.TRANSPARENT);

      rectangleSmall.setLayoutX(-7);
      rectangleSmall.setLayoutY(5);
      rectangleSmall.setFill(
          new LinearGradient(
              0,
              0,
              1,
              0,
              true,
              CycleMethod.NO_CYCLE,
              new Stop[] {
                new Stop(0, colorWeak), new Stop(0.5, colorStrong), new Stop(1, colorWeak)
              }));

      rectangleBig.setLayoutX(-14);
      rectangleBig.setLayoutY(0);
      rectangleBig.setFill(
          new LinearGradient(
              0,
              0,
              1,
              0,
              true,
              CycleMethod.NO_CYCLE,
              new Stop[] {
                new Stop(0, colorStrong), new Stop(0.5, colorWeak), new Stop(1, colorStrong)
              }));

      rectangleWatch.setFill(
          new LinearGradient(
              0,
              0,
              1,
              0,
              true,
              CycleMethod.NO_CYCLE,
              new Stop[] {
                new Stop(0, Color.web("#4e605f")),
                new Stop(0.2, Color.web("#c3d6d5")),
                new Stop(0.5, Color.web("#f9ffff")),
                new Stop(0.8, Color.web("#c3d6d5")),
                new Stop(1, Color.web("#4e605f"))
              }));
      rectangleWatch.setLayoutX(-12);
      rectangleWatch.setLayoutY(12);
    }
  @Override
  public void start(Stage stage) {
    if (!Platform.isSupported(ConditionalFeature.SCENE3D)) {
      throw new RuntimeException("*** ERROR: common conditional SCENE3D is not supported");
    }

    stage.setTitle("JavaFX SubScene And Scene Anti-aliasing Test");

    Group root = new Group();
    Scene scene = new Scene(root, 1000, 800);
    scene.setFill(Color.color(0.2, 0.2, 0.2, 1.0));

    HBox hbox = new HBox();
    hbox.setLayoutX(75);
    hbox.setLayoutY(200);

    PhongMaterial phongMaterial = new PhongMaterial(Color.color(1.0, 0.7, 0.8));
    Cylinder cylinder1 = new Cylinder(100, 200);
    cylinder1.setMaterial(phongMaterial);
    SubScene noMsaa =
        createSubScene(
            "Scene Anti-aliasing = false",
            cylinder1,
            Color.TRANSPARENT,
            new PerspectiveCamera(),
            false);
    hbox.getChildren().add(noMsaa);

    Cylinder cylinder2 = new Cylinder(100, 200);
    cylinder2.setMaterial(phongMaterial);
    SubScene msaa =
        createSubScene(
            "Scene Anti-aliasing = true",
            cylinder2,
            Color.TRANSPARENT,
            new PerspectiveCamera(),
            true);
    hbox.getChildren().add(msaa);

    Slider slider = new Slider(0, 360, 0);
    slider.setBlockIncrement(1);
    slider.setTranslateX(425);
    slider.setTranslateY(625);
    cylinder1.rotateProperty().bind(slider.valueProperty());
    cylinder2.rotateProperty().bind(slider.valueProperty());
    root.getChildren().addAll(hbox, slider);

    stage.setScene(scene);
    stage.show();
  }
Beispiel #24
0
  public Leaf(Branch parentBranch) {
    super(0, parentBranch.length / 2., 2, parentBranch.length / 2.);
    setScaleX(0); // trick to hide leaves
    setScaleY(0);

    double rand = random() * 0.5 + 0.3;
    AUTUMN_COLOR = Color.color(random() * 0.1 + 0.8, rand, rand / 2);

    Color color = new Color(random() * 0.5, random() * 0.5 + 0.5, 0, 1);
    if (parentBranch.globalH < 400 && random() < 0.8) { // bottom leaf is darker
      color = color.darker();
    }
    setFill(color);
  }
Beispiel #25
0
  static {
    preferences = Preferences.userNodeForPackage(ThemeManager.class);

    final StringProperty _baseColorProperty = new SimpleStringProperty();

    // restore the old value
    fontScaleProperty.set(preferences.getDouble(FONT_SIZE, 1));

    // Save the value when it changes
    fontScaleProperty.addListener(
        (observable, oldValue, newValue) -> {
          if (newValue != null) {
            preferences.putDouble(FONT_SIZE, newValue.doubleValue());
          }
        });

    baseColorProperty.setValue(Color.web(preferences.get(BASE_COLOR, DEFAULT_MODENA_BASE_COLOR)));

    // restore the old base color value
    switch (preferences.get(LAST, Application.STYLESHEET_MODENA)) {
      case Application.STYLESHEET_CASPIAN:
        baseColorProperty.setValue(
            Color.web(preferences.get(BASE_COLOR, DEFAULT_CASPIAN_BASE_COLOR)));
        break;
      case Application.STYLESHEET_MODENA:
        baseColorProperty.setValue(
            Color.web(preferences.get(BASE_COLOR, DEFAULT_MODENA_BASE_COLOR)));
        break;
      default:
        baseColorProperty.setValue(
            Color.web(preferences.get(BASE_COLOR, DEFAULT_MODENA_BASE_COLOR)));
    }

    _baseColorProperty.setValue(colorToHex(baseColorProperty.getValue()));

    // Save the value when it changes
    baseColorProperty.addListener(
        (observable, oldValue, newValue) -> {
          if (newValue != null) {
            preferences.put(BASE_COLOR, colorToHex(newValue));
            _baseColorProperty.setValue(colorToHex(newValue));
          }
        });

    // Create the binding format for the style / font size
    styleProperty =
        Bindings.format(
            "-fx-font-size: %1$.6fem; -fx-base:%2$s", fontScaleProperty, _baseColorProperty);
  }
Beispiel #26
0
 public void update() {
   PainelConfig config = main.getConfig();
   // servicos
   servidor.setText(config.get(PainelConfig.KEY_SERVER).getValue());
   unidadeAtual = config.get(PainelConfig.KEY_UNIDADE, Integer.class).getValue();
   updateUnidades(main.getService().buscarUnidades());
   // som e tema
   vocalizar.setSelected(config.get(PainelConfig.KEY_SOUND_VOICE, Boolean.class).getValue());
   corFundo.setValue(Color.web(config.get(PainelConfig.KEY_COR_FUNDO).getValue()));
   corMensagem.setValue(Color.web(config.get(PainelConfig.KEY_COR_MENSAGEM).getValue()));
   corSenha.setValue(Color.web(config.get(PainelConfig.KEY_COR_SENHA).getValue()));
   corGuiche.setValue(Color.web(config.get(PainelConfig.KEY_COR_GUICHE).getValue()));
   // screensaver
   videoUrl.setText(config.get(PainelConfig.KEY_SCREENSAVER_URL).getValue());
 }
Beispiel #27
0
  public static Polygon createArrow() {
    Polygon polygon =
        new Polygon(new double[] {7.5, 0, 15, 15, 10, 15, 10, 30, 5, 30, 5, 15, 0, 15});
    polygon.setFill(Color.web("#ff0900"));

    return polygon;
  }
    public Watch() {
      startButton = new Button(Color.web("#8cc700"), Color.web("#71a000"));
      stopButton = new Button(Color.web("#AA0000"), Color.web("#660000"));

      mainDial = new Dial(117, true, 12, 60, Color.RED, true);
      minutesDial = new Dial(30, false, 12, 60, "minutes", Color.BLACK, false);
      tenthsDial = new Dial(30, false, 12, 60, "10ths", Color.BLACK, false);

      configureBackground();
      myLayout();
      configureListeners();
      configureTimeline();
      getChildren()
          .addAll(
              background, minutesDial, tenthsDial, digitalClock, mainDial, startButton, stopButton);
    }
Beispiel #29
0
 // ******************** 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();
 }
Beispiel #30
0
 // REMOVE ME
 public static Node createIconContent() {
   Path path = new Path();
   path.getElements()
       .addAll(new MoveTo(25, 25), new HLineTo(45), new ArcTo(20, 20, 0, 80, 25, true, true));
   path.setStroke(Color.web("#b9c0c5"));
   path.setStrokeWidth(5);
   path.getStrokeDashArray().addAll(15d, 15d);
   path.setFill(null);
   javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
   effect.setOffsetX(1);
   effect.setOffsetY(1);
   effect.setRadius(3);
   effect.setColor(Color.rgb(0, 0, 0, 0.6));
   path.setEffect(effect);
   return path;
 }