Java 类javafx.scene.layout.BackgroundFill 实例源码

项目:Hive_Game    文件:NewGameScreenController.java   
public void majColorButton(){
    switch(state){
        case Consts.WHITE:
            colorPlayer1.setBackground(new Background(new BackgroundFill(new ImagePattern(new Image(getClass().getClassLoader().getResource("main/resources/img/misc/whitestart.png").toString())), CornerRadii.EMPTY, Insets.EMPTY)));
            colorPlayer2.setBackground(new Background(new BackgroundFill(new ImagePattern(new Image(getClass().getClassLoader().getResource("main/resources/img/misc/blackstart.png").toString())), CornerRadii.EMPTY, Insets.EMPTY)));
            break;
        case Consts.BLACK:
            colorPlayer2.setBackground(new Background(new BackgroundFill(new ImagePattern(new Image(getClass().getClassLoader().getResource("main/resources/img/misc/whitestart.png").toString())), CornerRadii.EMPTY, Insets.EMPTY)));
            colorPlayer1.setBackground(new Background(new BackgroundFill(new ImagePattern(new Image(getClass().getClassLoader().getResource("main/resources/img/misc/blackstart.png").toString())), CornerRadii.EMPTY, Insets.EMPTY)));
            break;
        case Consts.RANDOM:
            colorPlayer1.setBackground(new Background(new BackgroundFill(new ImagePattern(new Image(getClass().getClassLoader().getResource("main/resources/img/misc/rngstart.png").toString())), CornerRadii.EMPTY, Insets.EMPTY)));
            colorPlayer2.setBackground(new Background(new BackgroundFill(new ImagePattern(new Image(getClass().getClassLoader().getResource("main/resources/img/misc/rngstart.png").toString())), CornerRadii.EMPTY, Insets.EMPTY)));
            break;
        default:
            break;
    }
}
项目:Hive_Game    文件:NetworkScreenController.java   
@FXML
public void handleLaunchGameClick() {
               String player = "Anonyme";
    Core core = new Core(-1, -1);
    String host = choiceClient.isSelected() ? hostName.getText() : null;
    int mode = choiceHost.isSelected() ? (state == Consts.WHITE ? Consts.PVEX : Consts.EXVP) : -1;
               if(!playerName.getText().equals(""))
                   player = playerName.getText();
    int error = core.connect(host, mode, player);
    if (error == 0) {
        core.playNextTurn();
        main.showGameScreen(core,false);
    } else if (choiceClient.isSelected()) {
        hostName.setBackground(
                new Background(new BackgroundFill(Color.ORANGERED, new CornerRadii(2), new Insets(2))));
        hostName.clear();
        hostName.setText(error==1?"Host inconnnu":"Erreur de connexion");
    } else {
        playerName.setBackground(
                new Background(new BackgroundFill(Color.ORANGERED, new CornerRadii(2), new Insets(2))));
        playerName.clear();
        playerName.setText("Erreur de connexion");
    }
    // hostName.setBorder(new Border(new BorderStroke(Color.RED,
    // BorderStrokeStyle.SOLID, new CornerRadii(10), BorderWidths.FULL)));
}
项目:Hive_Game    文件:NetworkScreenController.java   
public void majColorButton() {
    switch (state) {
    case Consts.WHITE:
        colorHost.setBackground(new Background(new BackgroundFill(
                new ImagePattern(new Image(getClass().getClassLoader()
                        .getResource("main/resources/img/misc/whitestart.png").toString())),
                CornerRadii.EMPTY, Insets.EMPTY)));
        break;
    case Consts.BLACK:
        colorHost.setBackground(new Background(new BackgroundFill(
                new ImagePattern(new Image(getClass().getClassLoader()
                        .getResource("main/resources/img/misc/blackstart.png").toString())),
                CornerRadii.EMPTY, Insets.EMPTY)));
        break;
    case Consts.RANDOM:
        colorHost.setBackground(new Background(new BackgroundFill(
                new ImagePattern(new Image(getClass().getClassLoader()
                        .getResource("main/resources/img/misc/rngstart.png").toString())),
                CornerRadii.EMPTY, Insets.EMPTY)));
        break;
    default:
        break;
    }
}
项目:smoothcharts    文件:SmoothedChart.java   
public void setLegendSymbolFill(final Series<X, Y> SERIES, final Paint LEGEND_SYMBOL_FILL) {
    if (getData().isEmpty()) { return; }
    if (!getData().contains(SERIES)) { return; }

    int seriesIndex = getData().indexOf(SERIES);
    if (seriesIndex == -1) { return; }

    Legend legend = (Legend) getLegend();
    if (null == legend) { return; }

    LegendItem item = legend.getItems().get(seriesIndex);
    if (null == item) { return; }

    Region symbol = (Region) item.getSymbol();
    if (null == symbol) { return; }

    symbol.setBackground(new Background(new BackgroundFill(LEGEND_SYMBOL_FILL, new CornerRadii(6), Insets.EMPTY)));
}
项目:smoothcharts    文件:Demo.java   
@Override public void start(Stage stage) {
    GridPane pane = new GridPane();
    pane.setBackground(new Background(new BackgroundFill(Color.DARKGRAY, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setPadding(new Insets(10));
    pane.setHgap(10);
    pane.setVgap(10);
    pane.add(lineChartNotSmoothed, 0, 0);
    pane.add(lineChartSmoothed, 1, 0);
    pane.add(areaChartNotSmoothed, 0, 1);
    pane.add(areaChartSmoothed, 1, 1);
    pane.add(tweakedChart, 0, 2);
    pane.add(tweaked2Chart, 1, 2);


    Scene scene = new Scene(pane);

    stage.setTitle("Smooth Charts");
    stage.setScene(scene);
    stage.show();
}
项目:ChatRoom-JavaFX    文件:ChatController.java   
/**
 * 将自己的对话添加到对话列表中
 * @param content
 */
public void addYourMessges(String content){

    Platform.runLater(() ->{
        //寻找用户的头像名
        Image image = new Image("images/" + userPic);
           ImageView profileImage = new ImageView(image);
           profileImage.setFitHeight(32);
           profileImage.setFitWidth(32);
           BubbledTextFlow yourBubbled = new BubbledTextFlow(EmojiDisplayer.createEmojiAndTextNode(content));
           yourBubbled.setBackground(new Background(new BackgroundFill(Color.LIGHTGREEN,
                   null, null)));
           HBox x = new HBox();
           x.setMaxWidth(chatPaneListView.getWidth() - 20);
           x.setAlignment(Pos.TOP_RIGHT);
           yourBubbled.setBubbleSpec(BubbleSpec.FACE_RIGHT_CENTER);
           x.getChildren().addAll(yourBubbled, profileImage);
           chatPaneListView.getItems().add(x);
    });
}
项目:ChatRoom-JavaFX    文件:ChatController.java   
/**
 * 处理通知信息的显示
 * @param notice
 */
public void addNotification(String notice){
    Platform.runLater(() ->{
        SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss");//设置日期格式
        String timer = df.format(new Date());// new Date()为获取当前系统时间
        String content = timer +  ": " + notice;
        BubbledTextFlow noticeBubbled = new BubbledTextFlow(EmojiDisplayer.createEmojiAndTextNode(content));
        //noticeBubbled.setTextFill(Color.web("#031c30"));
        noticeBubbled.setBackground(new Background(new BackgroundFill(Color.WHITE,
                   null, null)));
           HBox x = new HBox();
           //x.setMaxWidth(chatPaneListView.getWidth() - 20);
           x.setAlignment(Pos.TOP_CENTER);
           noticeBubbled.setBubbleSpec(BubbleSpec.FACE_TOP);
           x.getChildren().addAll(noticeBubbled);
           chatPaneListView.getItems().add(x);
    });
}
项目:charts    文件:SunburstChart.java   
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
        Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    segmentPane = new Pane();

    chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    chartCanvas.setMouseTransparent(true);

    chartCtx    = chartCanvas.getGraphicsContext2D();

    pane = new Pane(segmentPane, chartCanvas);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));

    getChildren().setAll(pane);

    prepareData();
}
项目:CapsLock    文件:CharPanelGenerator.java   
/**
 * Generates a panel image form char.
 * <p>First, this function converts ch to upper case if ch is lower case.</p>
 * <p>Then, this generates javafx's image from ch.And return it.</p>
 * You can fix the resolution of image through {@link capslock.CharPanelGenerator#PANEL_IMAGE_SIZE}
 * and {@link capslock.CharPanelGenerator#FONT_SIZE}.
 * @param ch パネルの生成に使う1文字.
 * @param color 背景色.
 * @return 生成されたパネル.
 */
static final Image generate(char ch, Color color){
    final Label label = new Label(Character.toString(Character.toUpperCase(ch)));
    label.setMinSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    label.setMaxSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    label.setPrefSize(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    label.setFont(Font.font(FONT_SIZE));
    label.setAlignment(Pos.CENTER);
    label.setTextFill(Color.WHITE);
    label.setBackground(new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)));
    final Scene scene = new Scene(new Group(label));
    final WritableImage img = new WritableImage(PANEL_IMAGE_SIZE, PANEL_IMAGE_SIZE);
    scene.snapshot(img);
    return img ;
}
项目:tilesfx    文件:BarChartItem.java   
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 ||
        Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    nameText = new Text(getName());
    nameText.setTextOrigin(VPos.TOP);

    valueText = new Text(String.format(locale, formatString, getValue()));
    valueText.setTextOrigin(VPos.TOP);

    barBackground = new Rectangle();

    bar = new Rectangle();

    pane = new Pane(nameText, valueText, barBackground, bar);
    pane.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT, CornerRadii.EMPTY, Insets.EMPTY)));

    getChildren().setAll(pane);
}
项目:Medusa    文件:FlatSkin.java   
@Override protected void redraw() {
    colorGradientEnabled = gauge.isGradientBarEnabled();
    noOfGradientStops    = gauge.getGradientBarStops().size();
    sectionsVisible      = gauge.getSectionsVisible();

    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));

    setBarColor(gauge.getCurrentValue());
    valueText.setFill(gauge.getValueColor());
    unitText.setFill(gauge.getUnitColor());
    titleText.setFill(gauge.getTitleColor());
    separator.setStroke(gauge.getBorderPaint());

    titleText.setText(gauge.getTitle());
    resizeTitleText();

    unitText.setText(gauge.getUnit());
    resizeUnitText();
}
项目:Medusa    文件:SpaceXSkin.java   
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * width))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
    barColor                 = gauge.getBarColor();
    thresholdColor           = gauge.getThresholdColor();
    barBackgroundColor       = gauge.getBarBackgroundColor();
    thresholdBackgroundColor = Color.color(thresholdColor.getRed(), thresholdColor.getGreen(), thresholdColor.getBlue(), 0.25);
    barBackground.setFill(barBackgroundColor);
    thresholdBar.setFill(thresholdBackgroundColor);
    dataBar.setFill(barColor);
    dataBarThreshold.setFill(thresholdColor);

    titleText.setFill(gauge.getTitleColor());
    titleText.setText(gauge.getTitle());

    valueText.setFill(gauge.getValueColor());
    valueText.setText(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue()));
    valueText.relocate((width - valueText.getLayoutBounds().getWidth()), 0.58064516 * height);

    unitText.setFill(gauge.getUnitColor());
    unitText.setText(gauge.getUnit());
    unitText.relocate((width - unitText.getLayoutBounds().getWidth()), 0.79 * height);
}
项目:tilesfx    文件:RadarChart.java   
private void resize() {
    double width  = getWidth() - getInsets().getLeft() - getInsets().getRight();
    double height = getHeight() - getInsets().getTop() - getInsets().getBottom();
    size          = width < height ? width : height;

    if (size > 0) {
        pane.setMaxSize(size, size);
        pane.relocate((getWidth() - size) * 0.5, (getHeight() - size) * 0.5);
        pane.setBackground(new Background(new BackgroundFill(getChartBackgroundColor(), new CornerRadii(1024), Insets.EMPTY)));

        chartCanvas.setWidth(size);
        chartCanvas.setHeight(size);

        overlayCanvas.setWidth(size);
        overlayCanvas.setHeight(size);

        redraw();
    }
}
项目:Incubator    文件:Demo.java   
@Override
public void start(Stage stage) {        
    BorderPane pane = new BorderPane(flipPanel);
    pane.setPrefSize(400, 250);
    pane.setPadding(new Insets(50, 50, 50, 50));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(68, 68, 68), CornerRadii.EMPTY, Insets.EMPTY)));

    PerspectiveCamera camera = new PerspectiveCamera(false);
    camera.setFieldOfView(20);

    Scene scene = new Scene(pane);
    scene.setCamera(camera);
    scene.getStylesheets().add(Demo.class.getResource("styles.css").toExternalForm());

    stage.setTitle("FlipPanel Demo");
    stage.setScene(scene);
    stage.show();
}
项目:javaone2016    文件:OTNPreloader.java   
@Override
public void start(Stage primaryStage) throws Exception {
    stage = primaryStage;

    Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds();
    double width = IS_DESKTOP ? 350 : visualBounds.getWidth();
    double height = IS_DESKTOP ? 700 : visualBounds.getHeight();

    ImageView imageView = new ImageView(OTNPreloader.class.getResource("preload_small.png").toExternalForm());
    imageView.setPreserveRatio(true);
    imageView.setFitWidth(width * 0.50);

    StackPane stackPane = new StackPane(imageView);
    stackPane.setBackground(new Background(new BackgroundFill(Color.WHITE, null, null)));

    Scene scene = new Scene(stackPane, width, height);

    stage.setScene(scene);
    stage.show();
}
项目:hol1634    文件:Region.java   
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 ||
        Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    getStyleClass().add("my-region");

    pane = new Pane();                
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));

    getChildren().setAll(pane);
}
项目:particlesfx    文件:NodeBubbles.java   
@Override public void start(Stage stage) {
    Pane pane = new Pane(particles);
    pane.setPrefSize(WIDTH, HEIGHT);
    pane.setBackground(new Background(new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);
    scene.getStylesheets().add(getClass().getResource("styles.css").toExternalForm());

    stage.setTitle("NodeBubbles");
    stage.setScene(scene);
    stage.show();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");
    System.out.println(NO_OF_PARTICLES + " Particles");

    timer.start();
}
项目:Jeu-des-6-couleurs    文件:Home.java   
@Override
public void start(Stage stage) throws Exception {
  try {
    // Chargement de l'interface FXML
    GridPane root = FXMLLoader.load(getClass().getResource("Home.fxml"));

    root.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));

    // Création de la scène
    Scene scene = new Scene(root);

    stage.setTitle("Jeu des 6 couleurs");
    stage.setScene(scene);
    stage.show();

    mainStage = stage;
  } catch(Exception e) {
    e.printStackTrace();
  }
}
项目:Jeu-des-6-couleurs    文件:Home.java   
@FXML
protected void showAbout(ActionEvent event) {
  try {
    FXMLLoader loader = new FXMLLoader(getClass().getResource("About.fxml"));

    GridPane aboutRoot = loader.load();

    About aboutController = loader.getController();

    aboutController.setHostServices(getHostServices());

    aboutRoot.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));

    Stage dialog = new Stage();
    dialog.setTitle("Jeu des 6 couleurs - A propos");
    dialog.setScene(new Scene(aboutRoot));
    dialog.show();
  } catch (Exception e) {
    e.printStackTrace();
  }
}
项目:MoodFX    文件:ConfigView.java   
public ConfigView(final String NAME) {
    super(NAME);

    try {
        localStoragePath = PlatformFactory.getPlatform().getPrivateStorage();
    } catch (IOException e) {
        String tmp = System.getProperty("java.io.tmpdir");
        localStoragePath = new File(tmp);
    }
    properties = createProperties();
    retrieveConfig();

    init();
    registerListeners();

    setBackground(new Background(new BackgroundFill(MoodFX.BACKGROUND_COLOR.brighter(), CornerRadii.EMPTY, Insets.EMPTY)));
    setCenter(configPane);
    setShowTransitionFactory(SlideInRightTransition::new);
}
项目:Retrospector    文件:Retrospector.java   
@Override
public void init() {
    ImageView splash = new ImageView(new Image(
            SPLASH_IMAGE,
            SPLASH_WIDTH,
            SPLASH_HEIGHT,
            true,
            true
    ));
    loadProgress = new ProgressBar(0);
    loadProgress.setPrefWidth(SPLASH_WIDTH);
    progressText = new Label("Initializing . . .");
    progressText.setBackground(new Background(new BackgroundFill(Color.GHOSTWHITE,new CornerRadii(5),new Insets(0))));
    splashLayout = new VBox();
    splashLayout.getChildren().addAll(splash, loadProgress, progressText);
    progressText.setAlignment(Pos.CENTER);
    splashLayout.setBackground(Background.EMPTY);
}
项目:hol1634    文件:Skin.java   
private void initGraphics() {
    if (Double.compare(getSkinnable().getPrefWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getPrefHeight(), 0.0) <= 0 ||
        Double.compare(getSkinnable().getWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getHeight(), 0.0) <= 0) {
        if (getSkinnable().getPrefWidth() > 0 && getSkinnable().getPrefHeight() > 0) {
            getSkinnable().setPrefSize(getSkinnable().getPrefWidth(), getSkinnable().getPrefHeight());
        } else {
            getSkinnable().setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    node = new Region();
    node.getStyleClass().setAll("node");

    pane = new Pane(node);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));

    getChildren().setAll(pane);
}
项目:medusademo    文件:TemplateGaugeSkin.java   
private void initGraphics() {
    // Set initial size
    if (Double.compare(getSkinnable().getPrefWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getPrefHeight(), 0.0) <= 0 ||
        Double.compare(getSkinnable().getWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getHeight(), 0.0) <= 0) {
        if (getSkinnable().getPrefWidth() > 0 && getSkinnable().getPrefHeight() > 0) {
            getSkinnable().setPrefSize(getSkinnable().getPrefWidth(), getSkinnable().getPrefHeight());
        } else {
            getSkinnable().setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    pane = new Pane();
    pane.setBorder(new Border(new BorderStroke(getSkinnable().getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1))));
    pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

    getChildren().setAll(pane);
}
项目:medusademo    文件:CustomGaugeSkin.java   
private void initGraphics() {
    backgroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    backgroundCtx    = backgroundCanvas.getGraphicsContext2D();

    foregroundCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    foregroundCtx    = foregroundCanvas.getGraphicsContext2D();

    ledInnerShadow   = new InnerShadow(BlurType.TWO_PASS_BOX, Color.BLACK, 0.2 * PREFERRED_WIDTH, 0, 0, 0);
    ledDropShadow    = new DropShadow(BlurType.TWO_PASS_BOX, getSkinnable().getBarColor(), 0.3 * PREFERRED_WIDTH, 0, 0, 0);

    pane = new Pane(backgroundCanvas, foregroundCanvas);
    pane.setBorder(new Border(new BorderStroke(getSkinnable().getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1))));
    pane.setBackground(new Background(new BackgroundFill(getSkinnable().getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

    getChildren().setAll(pane);
}
项目:medusademo    文件:CustomGaugeSkinDemo.java   
@Override public void start(Stage stage) {
    HBox pane = new HBox(gauge0, gauge1, gauge2, gauge3, gauge4, gauge5, gauge6, gauge7, gauge8, gauge9);
    pane.setBackground(new Background(new BackgroundFill(Gauge.DARK_COLOR, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setPadding(new Insets(10));

    Scene scene = new Scene(pane);

    stage.setTitle("Medusa Custom Gauge Skin");
    stage.setScene(scene);
    stage.show();

    timer.start();

    // Calculate number of nodes
    calcNoOfNodes(pane);
    System.out.println(noOfNodes + " Nodes in SceneGraph");
}
项目:openjfx-8u-dev-tests    文件:RT_17348Test.java   
@Test
public void changeStylesheetTest() {
    Wrap<? extends Scene> scene = Root.ROOT.lookup(Scene.class).wrap();
    Parent<Node> sceneParent = scene.as(Parent.class, Node.class);
    final Wrap<Region> pane = (Wrap<Region>) sceneParent.lookup(new ByID<Node>(StylesheetApp.EXAMPLE_ID)).wrap();
    Assert.assertNotNull(pane);
    Assert.assertNotNull(pane.getControl().backgroundProperty().get());
    Assert.assertEquals(pane.getControl().backgroundProperty().get(), new Background(new BackgroundFill(Color.RED, CornerRadii.EMPTY, Insets.EMPTY)));
    Assert.assertNotSame(pane.getControl().backgroundProperty().get(), new Background(new BackgroundFill(Color.BLUE, CornerRadii.EMPTY, Insets.EMPTY)));
    Wrap<? extends Text> button = sceneParent.lookup(Text.class).wrap();
    button.mouse().click();
    pane.waitState(new State() {
        @Override
        public Object reached() {
            return !pane.getControl().backgroundProperty().get().equals(new Background(new BackgroundFill(Color.RED, CornerRadii.EMPTY, Insets.EMPTY))) ? true : null;
        }
    });
    Assert.assertNotNull(pane.getControl().backgroundProperty().get());
    Assert.assertEquals(pane.getControl().backgroundProperty().get(), new Background(new BackgroundFill(Color.BLUE, CornerRadii.EMPTY, Insets.EMPTY)));
    Assert.assertNotSame(pane.getControl().backgroundProperty().get(), new Background(new BackgroundFill(Color.RED, CornerRadii.EMPTY, Insets.EMPTY)));
}
项目:Medusa    文件:KpiSkin.java   
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

    locale = gauge.getLocale();

    titleText.setText(gauge.getTitle());
    minValueText.setText(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMinValue()));
    maxValueText.setText(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getMaxValue()));
    thresholdText.setText(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getThreshold()));
    resizeStaticText();

    barBackground.setStroke(gauge.getBarColor());
    thresholdBar.setStroke(gauge.getThresholdColor());
    needle.setFill(gauge.getNeedleColor());
    titleText.setFill(gauge.getTitleColor());
    minValueText.setFill(gauge.getTitleColor());
    maxValueText.setFill(gauge.getTitleColor());
    thresholdText.setFill(gauge.getTitleColor());
    valueText.setFill(gauge.getValueColor());

    thresholdText.setVisible(Double.compare(gauge.getThreshold(), gauge.getMinValue()) != 0 && Double.compare(gauge.getThreshold(), gauge.getMaxValue()) != 0);
}
项目:Medusa    文件:SimpleDigitalSkin.java   
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    barColor        = gauge.getBarColor();
    valueColor      = gauge.getValueColor();
    unitColor       = gauge.getUnitColor();
    sectionsVisible = gauge.getSectionsVisible();
    drawBackground();
    resizeStaticText();

    setBar(gauge.getCurrentValue());

    titleText.setText(gauge.getTitle());
    titleText.setFill(gauge.getTitleColor());
    titleText.relocate((size - titleText.getLayoutBounds().getWidth()) * 0.5, size * 0.22180451);

    valueBkgText.setFill(Helper.getTranslucentColorFrom(valueColor, 0.1));
    valueText.setFill(valueColor);
}
项目:Medusa    文件:TileSparklineSkin.java   
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(size * 0.025), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(size * 0.025), Insets.EMPTY)));

    locale       = gauge.getLocale();
    formatString = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f").toString();

    titleText.setText(gauge.getTitle());
    subTitleText.setText(gauge.getSubTitle());
    resizeStaticText();

    titleText.setFill(gauge.getTitleColor());
    valueText.setFill(gauge.getValueColor());
    averageText.setFill(gauge.getAverageColor());
    highText.setFill(gauge.getValueColor());
    lowText.setFill(gauge.getValueColor());
    subTitleText.setFill(gauge.getSubTitleColor());
    sparkLine.setStroke(gauge.getBarColor());
    stdDeviationArea.setFill(Helper.getTranslucentColorFrom(gauge.getAverageColor(), 0.1));
    averageLine.setStroke(gauge.getAverageColor());
    dot.setFill(gauge.getBarColor());
}
项目:hol1634    文件:Skin.java   
private void initGraphics() {
    if (Double.compare(getSkinnable().getPrefWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getPrefHeight(), 0.0) <= 0 ||
        Double.compare(getSkinnable().getWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getHeight(), 0.0) <= 0) {
        if (getSkinnable().getPrefWidth() > 0 && getSkinnable().getPrefHeight() > 0) {
            getSkinnable().setPrefSize(getSkinnable().getPrefWidth(), getSkinnable().getPrefHeight());
        } else {
            getSkinnable().setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    node = new Region();
    node.getStyleClass().setAll("node");

    pane = new Pane(node);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));

    getChildren().setAll(pane);
}
项目:Medusa    文件:TinySkin.java   
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

    locale               = gauge.getLocale();
    formatString         = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f").toString();
    colorGradientEnabled = gauge.isGradientBarEnabled();
    noOfGradientStops    = gauge.getGradientBarStops().size();

    barBackground.setStroke(gauge.getBarBackgroundColor());

    // Areas, Sections and Tick Marks
    sectionCanvas.setCache(false);
    sectionCtx.clearRect(0, 0, size, size);
    if (gauge.isGradientBarEnabled() && gauge.getGradientLookup() != null) {
        drawGradientBar();
        if (gauge.getMajorTickMarksVisible()) drawTickMarks();
    } else if (gauge.getSectionsVisible()) {
        drawSections();
        if (gauge.getMajorTickMarksVisible()) drawTickMarks();
    }
    sectionCanvas.setCache(true);
    sectionCanvas.setCacheHint(CacheHint.QUALITY);

    needle.setFill(gauge.getNeedleColor());
}
项目:Medusa    文件:DashboardSkin.java   
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(gauge.getBorderWidth() / 250 * size))));
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

    colorGradientEnabled = gauge.isGradientBarEnabled();
    noOfGradientStops    = gauge.getGradientBarStops().size();
    sectionsVisible      = gauge.getSectionsVisible();

    barBackground.setFill(gauge.getBarBackgroundColor());
    barBackground.setEffect(gauge.isShadowsEnabled() ? innerShadow : null);

    setBarColor(gauge.getCurrentValue());

    dataBar.setEffect(gauge.isShadowsEnabled() ? innerShadow : null);

    threshold.setStroke(gauge.getThresholdColor());
    double thresholdInnerRadius = 0.3 * height;
    double thresholdOuterRadius = 0.675 * height;
    double thresholdAngle       = Helper.clamp(90.0, 270.0, (gauge.getThreshold() - minValue) * angleStep + 90.0);
    threshold.setStartX(centerX + thresholdInnerRadius * Math.sin(-Math.toRadians(thresholdAngle)));
    threshold.setStartY(centerX + thresholdInnerRadius * Math.cos(-Math.toRadians(thresholdAngle)));
    threshold.setEndX(centerX + thresholdOuterRadius * Math.sin(-Math.toRadians(thresholdAngle)));
    threshold.setEndY(centerX + thresholdOuterRadius * Math.cos(-Math.toRadians(thresholdAngle)));

    redrawText();
}
项目:Medusa    文件:DigitalSkin.java   
@Override protected void redraw() {
    pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth() / PREFERRED_WIDTH * size))));

    locale          = gauge.getLocale();
    barColor        = gauge.getBarColor();
    valueColor      = gauge.getValueColor();
    titleColor      = gauge.getTitleColor();
    subTitleColor   = gauge.getSubTitleColor();
    unitColor       = gauge.getUnitColor();
    sectionsVisible = gauge.getSectionsVisible();
    drawBackground();

    setBar(gauge.getCurrentValue());

    valueBkgText.setFill(Helper.getTranslucentColorFrom(valueColor, 0.1));

    valueText.setFill(valueColor);
}
项目:Medusa    文件:DesignClockSkin.java   
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth() / PREFERRED_WIDTH * size))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

    shadowGroup.setEffect(clock.getShadowsEnabled() ? dropShadow : null);

    // Tick Marks
    tickCanvas.setCache(false);
    drawTicks();
    tickCanvas.setCache(true);
    tickCanvas.setCacheHint(CacheHint.QUALITY);

    needle.setStroke(clock.getHourColor());

    ZonedDateTime time = clock.getTime();

    updateTime(time);
}
项目:Medusa    文件:SlimClockSkin.java   
@Override protected void redraw() {
    pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(clock.getBorderWidth() / 250 * size))));
    pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

    secondBackgroundCircle.setStroke(Helper.getTranslucentColorFrom(clock.getSecondColor(), 0.2));
    secondArc.setStroke(clock.getSecondColor());

    hour.setFill(clock.getHourColor());
    minute.setFill(clock.getMinuteColor());

    dateText.setFill(clock.getDateColor());
    dateNumbers.setFill(clock.getDateColor());

    hour.setFill(clock.getHourColor());
    minute.setFill(clock.getMinuteColor());

    ZonedDateTime time = clock.getTime();
    updateTime(time);
}
项目:hygene    文件:PathController.java   
@Override
public void initialize(final URL location, final ResourceBundle resources) {
    nameColumn.setCellValueFactory(cell -> {
        if (cell.getValue().getName() == null) {
            return new SimpleStringProperty("[unknown genome]");
        } else {
            return new SimpleStringProperty(cell.getValue().getName());
        }
    });

    colorColumn.setCellValueFactory(cell -> cell.getValue().getColor());

    colorColumn.setCellFactory(cell -> new TableCell<GenomePath, Color>() {
        @Override
        protected void updateItem(final Color color, final boolean empty) {
            super.updateItem(color, empty);

            if (color == null) {
                setBackground(Background.EMPTY);
            } else {
                setBackground(new Background(new BackgroundFill(color, CornerRadii.EMPTY, Insets.EMPTY)));
            }
        }
    });

    selectedColumn.setCellValueFactory(cell -> cell.getValue().selectedProperty());

    selectedColumn.setCellFactory(CheckBoxTableCell.forTableColumn(selectedColumn));

    final FilteredList<GenomePath> filteredList = new FilteredList<>(graphVisualizer.getGenomePathsProperty(),
            s -> s.getName().contains(searchField.textProperty().get()));

    pathTable.setItems(filteredList);

    pathTable.setEditable(true);

    addListeners();
}
项目:SunburstChart    文件:SunburstChart.java   
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
        Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    segmentPane = new Pane();

    chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    chartCanvas.setMouseTransparent(true);

    chartCtx    = chartCanvas.getGraphicsContext2D();

    pane = new Pane(segmentPane, chartCanvas);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));

    getChildren().setAll(pane);

    prepareData();
}
项目:SunburstChart    文件:SunburstChart.java   
private void redraw() {
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth / PREFERRED_WIDTH * size))));

    segmentPane.setBackground(new Background(new BackgroundFill(getBackgroundColor(), CornerRadii.EMPTY, Insets.EMPTY)));
    segmentPane.setManaged(isInteractive());
    segmentPane.setVisible(isInteractive());

    drawChart();
}
项目:radialchart    文件:RadialChart.java   
private void initGraphics() {
    if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 ||
        Double.compare(getWidth(), 0.0) <= 0 || Double.compare(getHeight(), 0.0) <= 0) {
        if (getPrefWidth() > 0 && getPrefHeight() > 0) {
            setPrefSize(getPrefWidth(), getPrefHeight());
        } else {
            setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
        }
    }

    canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ctx    = canvas.getGraphicsContext2D();

    pane = new Pane(canvas);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));

    getChildren().setAll(pane);
}
项目:radialchart    文件:Demo.java   
@Override public void start(Stage stage) {
    StackPane pane = new StackPane(graph);
    pane.setPadding(new Insets(10));
    pane.setBackground(new Background(new BackgroundFill(Color.rgb(40, 40, 40), CornerRadii.EMPTY, Insets.EMPTY)));

    Scene scene = new Scene(pane);

    stage.setTitle("Radial Chart");
    stage.setScene(scene);
    stage.show();

    timer.start();
}