Java Code Examples for javafx.scene.paint.Color#GRAY

The following examples show how to use javafx.scene.paint.Color#GRAY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ColorPickerSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public ColorPickerSample() {
    final ColorPicker colorPicker = new ColorPicker(Color.GRAY);
    ToolBar standardToolbar = ToolBarBuilder.create().items(colorPicker).build();

    final Text coloredText = new Text("Colors");
    Font font = new Font(53);
    coloredText.setFont(font);
    final Button coloredButton = new Button("Colored Control");
    Color c = colorPicker.getValue();
    coloredText.setFill(c);
    coloredButton.setStyle(createRGBString(c));

    colorPicker.setOnAction(new EventHandler() {

        public void handle(Event t) {
            Color newColor = colorPicker.getValue();
            coloredText.setFill(newColor);                          
            coloredButton.setStyle(createRGBString(newColor));
        }
    });

    VBox coloredObjectsVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(coloredText, coloredButton).build();        
    VBox outerVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(150).padding(new Insets(0, 0, 120, 0)).children(standardToolbar, coloredObjectsVBox).build();
    getChildren().add(outerVBox);
}
 
Example 2
Source File: ColorPickerSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public ColorPickerSample() {
    final ColorPicker colorPicker = new ColorPicker(Color.GRAY);
    ToolBar standardToolbar = ToolBarBuilder.create().items(colorPicker).build();

    final Text coloredText = new Text("Colors");
    Font font = new Font(53);
    coloredText.setFont(font);
    final Button coloredButton = new Button("Colored Control");
    Color c = colorPicker.getValue();
    coloredText.setFill(c);
    coloredButton.setStyle(createRGBString(c));

    colorPicker.setOnAction(new EventHandler() {

        public void handle(Event t) {
            Color newColor = colorPicker.getValue();
            coloredText.setFill(newColor);                          
            coloredButton.setStyle(createRGBString(newColor));
        }
    });

    VBox coloredObjectsVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(coloredText, coloredButton).build();        
    VBox outerVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(150).padding(new Insets(0, 0, 120, 0)).children(standardToolbar, coloredObjectsVBox).build();
    getChildren().add(outerVBox);
}
 
Example 3
Source File: IconFactory.java    From metastone with GNU General Public License v2.0 6 votes vote down vote up
public static Color getRarityColor(Rarity rarity) {
	Color color = Color.BLACK;
	switch (rarity) {
	case COMMON:
		color = Color.WHITE;
		break;
	case EPIC:
		// a335ee
		color = Color.rgb(163, 53, 238);
		break;
	case LEGENDARY:
		// ff8000
		color = Color.rgb(255, 128, 0);
		break;
	case RARE:
		// 0070dd
		color = Color.rgb(0, 112, 221);
		break;
	default:
		color = Color.GRAY;
		break;
	}
	return color;

}
 
Example 4
Source File: ColorPickerDemo.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root));
    final ColorPicker colorPicker = new ColorPicker(Color.GRAY);
    ToolBar standardToolbar = ToolBarBuilder.create().items(colorPicker).build();

    final Text coloredText = new Text("Colors");
    Font font = new Font(53);
    coloredText.setFont(font);
    final Button coloredButton = new Button("Colored Control");
    Color c = colorPicker.getValue();
    coloredText.setFill(c);
    coloredButton.setStyle(createRGBString(c));

    colorPicker.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent t) {
            Color newColor = colorPicker.getValue();
            coloredText.setFill(newColor);                          
            coloredButton.setStyle(createRGBString(newColor));
        }
    });

    VBox coloredObjectsVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(20).children(coloredText, coloredButton).build();        
    VBox outerVBox = VBoxBuilder.create().alignment(Pos.CENTER).spacing(150).padding(new Insets(0, 0, 120, 0)).children(standardToolbar, coloredObjectsVBox).build();
    root.getChildren().add(outerVBox);
}
 
Example 5
Source File: StateCell.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
static Color getStateColor(final ScanState state)
{
    switch (state)
    {
    case Idle:      return Color.DARKBLUE;
    case Aborted:   return Color.DARKGOLDENROD;
    case Failed:    return Color.RED;
    case Finished:  return Color.DARKGREEN;
    case Paused:    return Color.GRAY;
    case Running:   return Color.GREEN;
    default:        return Color.BLACK;
    }
}
 
Example 6
Source File: EpidemicReportsSettingsController.java    From MyBox with Apache License 2.0 4 votes vote down vote up
@FXML
public void defaultValuesColors() {
    Color color = Color.BLUE;
    confirmedRect.setFill(color);
    FxmlControl.setTooltip(confirmedRect, new Tooltip(FxmlColor.colorNameDisplay(color)));

    color = Color.RED;
    healedRect.setFill(color);
    FxmlControl.setTooltip(healedRect, new Tooltip(FxmlColor.colorNameDisplay(color)));

    color = Color.BLACK;
    deadRect.setFill(color);
    FxmlControl.setTooltip(deadRect, new Tooltip(FxmlColor.colorNameDisplay(color)));

    color = Color.SLATEBLUE;
    IncreasedConfirmedRect.setFill(color);
    FxmlControl.setTooltip(IncreasedConfirmedRect, new Tooltip(FxmlColor.colorNameDisplay(color)));

    color = Color.HOTPINK;
    IncreasedHealedRect.setFill(color);
    FxmlControl.setTooltip(IncreasedHealedRect, new Tooltip(FxmlColor.colorNameDisplay(color)));

    color = Color.GRAY;
    IncreasedDeadRect.setFill(color);
    FxmlControl.setTooltip(IncreasedDeadRect, new Tooltip(FxmlColor.colorNameDisplay(color)));

    color = Color.PALEGREEN;
    HealedConfirmedPermillageRect.setFill(color);
    FxmlControl.setTooltip(HealedConfirmedPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));

    color = Color.STEELBLUE;
    DeadConfirmedPermillageRect.setFill(color);
    FxmlControl.setTooltip(DeadConfirmedPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));

    color = Color.MEDIUMPURPLE;
    ConfirmedPopulationPermillageRect.setFill(color);
    FxmlControl.setTooltip(ConfirmedPopulationPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));

    color = Color.SADDLEBROWN;
    DeadPopulationPermillageRect.setFill(color);
    FxmlControl.setTooltip(DeadPopulationPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));

    color = Color.LIGHTPINK;
    HealedPopulationPermillageRect.setFill(color);
    FxmlControl.setTooltip(HealedPopulationPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));

    color = Color.BLUEVIOLET;
    ConfirmedAreaPermillageRect.setFill(color);
    FxmlControl.setTooltip(ConfirmedAreaPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));

    color = Color.MEDIUMVIOLETRED;
    HealedAreaPermillageRect.setFill(color);
    FxmlControl.setTooltip(HealedAreaPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));

    color = Color.SILVER;
    DeadAreaPermillageRect.setFill(color);
    FxmlControl.setTooltip(DeadAreaPermillageRect, new Tooltip(FxmlColor.colorNameDisplay(color)));

}
 
Example 7
Source File: JFXDatePickerContent.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
protected BorderPane createCalendarArrowsPane() {

        SVGGlyph leftChevron = new SVGGlyph(0,
            "CHEVRON_LEFT",
            "M 742,-37 90,614 Q 53,651 53,704.5 53,758 90,795 l 652,651 q 37,37 90.5,37 53.5,0 90.5,-37 l 75,-75 q 37,-37 37,-90.5 0,-53.5 -37,-90.5 L 512,704 998,219 q 37,-38 37,-91 0,-53 -37,-90 L 923,-37 Q 886,-74 832.5,-74 779,-74 742,-37 z",
            Color.GRAY);
        SVGGlyph rightChevron = new SVGGlyph(0,
            "CHEVRON_RIGHT",
            "m 1099,704 q 0,-52 -37,-91 L 410,-38 q -37,-37 -90,-37 -53,0 -90,37 l -76,75 q -37,39 -37,91 0,53 37,90 l 486,486 -486,485 q -37,39 -37,91 0,53 37,90 l 76,75 q 36,38 90,38 54,0 90,-38 l 652,-651 q 37,-37 37,-90 z",
            Color.GRAY);
        leftChevron.setFill(DEFAULT_COLOR);
        leftChevron.setSize(6, 11);
        rightChevron.setFill(DEFAULT_COLOR);
        rightChevron.setSize(6, 11);

        backMonthButton = new JFXButton();
        backMonthButton.setMinSize(40, 40);
        backMonthButton.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,
            new CornerRadii(40),
            Insets.EMPTY)));
        backMonthButton.getStyleClass().add("left-button");
        backMonthButton.setGraphic(leftChevron);
        backMonthButton.setRipplerFill(this.datePicker.getDefaultColor());
        backMonthButton.setOnAction(t -> forward(-1, MONTHS, false, true));

        forwardMonthButton = new JFXButton();
        forwardMonthButton.setMinSize(40, 40);
        forwardMonthButton.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,
            new CornerRadii(40),
            Insets.EMPTY)));
        forwardMonthButton.getStyleClass().add("right-button");
        forwardMonthButton.setGraphic(rightChevron);
        forwardMonthButton.setRipplerFill(this.datePicker.getDefaultColor());
        forwardMonthButton.setOnAction(t -> forward(1, MONTHS, false, true));

        BorderPane arrowsContainer = new BorderPane();
        arrowsContainer.setLeft(backMonthButton);
        arrowsContainer.setRight(forwardMonthButton);
        arrowsContainer.setPadding(new Insets(4, 12, 2, 12));
        arrowsContainer.setPickOnBounds(false);
        return arrowsContainer;
    }
 
Example 8
Source File: StyledTextField.java    From RichTextFX with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private final ObjectProperty<Paint> promptTextFillProperty() {
    if ( promptFillProp == null ) {
        promptFillProp = new CustomStyleableProperty<>( Color.GRAY, "promptFill", this, PROMPT_TEXT_FILL );
    }
    return promptFillProp;
}
 
Example 9
Source File: RadialColorMenu.java    From RadialFx with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void addColorItem(final Color color, final double startAngle,
    final double length) {

final RadialMenuItem colorItem = RadialMenuItemBuilder.create()
	.startAngle(startAngle).length(length).backgroundFill(color)
	.backgroundMouseOnFill(color).strokeVisible(false).offset(minOffset)
	.innerRadius(60).radius(140).build();
getChildren().add(colorItem);

final Path extGraphic = PathBuilder
	.create()
	.elements(MoveToBuilder.create().x(-2.5).y(0).build(),
		LineToBuilder.create().x(-2.5).y(5).build(),
		LineToBuilder.create().x(2.5).y(0).build(),
		LineToBuilder.create().x(-2.5).y(-5).build(),
		LineToBuilder.create().x(-2.5).y(0).build())
	.fill(Color.WHITE)
	.stroke(null)
	.rotate(-colorItem.startAngleProperty().get()
		- colorItem.lengthProperty().get() / 2.0)

	.build();
final RadialMenuItem colorItemExt = RadialMenuItemBuilder.create()
	.startAngle(startAngle).length(length).backgroundFill(color)
	.backgroundMouseOnFill(color).strokeVisible(false)
	.innerRadius(142).radius(180).graphic(extGraphic).offset(minOffset)
	.build();

getChildren().add(colorItemExt);
colorItemExt.setOnMouseClicked(itemExtMouseHandler);

final Paint selectColor = Color.GRAY;
final double colorOffset = 6;
final RadialMenuItem colorItemSel = RadialMenuItemBuilder.create()
	.startAngle(startAngle + colorOffset).offset(minOffset)
	.length(length - colorOffset * 2).backgroundFill(selectColor)
	.strokeVisible(false).innerRadius(132).radius(134).build();
colorItemSel.setOpacity(0.0);
getChildren().add(colorItemSel);

final EventHandler<MouseEvent> mouseHandler = new ItemOnEventHandler(
	colorItemSel, colorItem, colorItemExt);
colorItem.setOnMouseEntered(mouseHandler);
colorItem.setOnMouseExited(mouseHandler);
colorItem.setOnMouseMoved(mouseHandler);
   }