當前位置: 首頁>>代碼示例>>Java>>正文


Java Color.GRAY屬性代碼示例

本文整理匯總了Java中javafx.scene.paint.Color.GRAY屬性的典型用法代碼示例。如果您正苦於以下問題:Java Color.GRAY屬性的具體用法?Java Color.GRAY怎麽用?Java Color.GRAY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javafx.scene.paint.Color的用法示例。


在下文中一共展示了Color.GRAY屬性的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: start

@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.setOnShowing(event -> uiHandlers.onShow());
    BorderPane border = new BorderPane();
    hbox = new HBox();
    border.setTop(hbox);
    hbox.setMinHeight(60);
    hbox.setAlignment(Pos.CENTER_LEFT);
    hbox.setBackground(new Background(new BackgroundFill(Color.web("#2196f3"), CornerRadii.EMPTY, Insets.EMPTY)));
    hbox.setPadding(new Insets(10));

    menu = new VBox();
    menu.setPadding(new Insets(20, 0, 0, 0));
    BorderStroke borderStroke = new BorderStroke(Color.GRAY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(0,1,0,0));

    menu.setBorder(new Border(borderStroke));
    menu.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY)));
    menu.setMinWidth(50);
    menu.setSpacing(20);
    border.setLeft(menu);


    primaryStage.setTitle("Todo list");

    Text text = new Text("Todo List");
    text.setFill(Color.WHITE);
    text.setFont(Font.font("Verdana", FontWeight.BOLD, 25));

    center = new VBox();
    center.setPadding(new Insets(20));
    center.setSpacing(10);
    Image image = new Image(getClass().getResourceAsStream("/add.png"));
    Button add = new Button("", new ImageView(image));
    add.setCursor(Cursor.HAND);
    add.setBackground(Background.EMPTY);
    add.setMinSize(Button.USE_PREF_SIZE, Button.USE_PREF_SIZE);
    add.setOnAction(event -> uiHandlers.onCreate());

    border.setCenter(center);

    hbox.setPadding(new Insets(10, 10, 10, 10));

    final Pane spacer = new Pane();
    HBox.setHgrow(spacer, Priority.ALWAYS);
    spacer.setMinSize(10, 1);
    hbox.getChildren().addAll(text, spacer, add);

    primaryStage.setScene(new Scene(border, 500, 500));
    primaryStage.show();
}
 
開發者ID:GwtDomino,項目名稱:domino-todolist,代碼行數:50,代碼來源:DesktopLayoutView.java

示例2: ColorPickerSample

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);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:25,代碼來源:ColorPickerSample.java

示例3: getPaint

private static Paint getPaint(IPixel p)
{
    switch (p.getColor())
    {
        case 0:
            return (Color.RED);
        case 1:
            return (Color.LIME);//color set to lime, because it is fully saturated (unlike "green")
        case 2:
            return (Color.BLUE);
        case 3:
            return (Color.GRAY);
        case 4:
            return (Color.BLACK);
        case 5:
            return (Color.WHITE);
        default:
            throw new IllegalStateException("Invalid color code " + p.getColor() + ".");
    }
}
 
開發者ID:AutonomousCarProject,項目名稱:AutonomousCar,代碼行數:20,代碼來源:AlternatingBlobDetectionRender.java

示例4: getPaint

private static Paint getPaint(IPixel p)
{
    switch (p.getColor())
    {
        case 0:
            return (Color.RED);
        case 1:
            return (Color.LIME);
        case 2:
            return (Color.BLUE);
        case 3:
            return (Color.GRAY);
        case 4:
            return (Color.BLACK);
        case 5:
            return (Color.WHITE);
        default:
            throw new IllegalStateException("Invalid color code " + p.getColor() + ".");
    }
}
 
開發者ID:AutonomousCarProject,項目名稱:AutonomousCar,代碼行數:20,代碼來源:BlobDetectionRender.java

示例5: baseToColor

/**
 * Returns the color of a given base.
 * <p>
 * Must be either `A`, `T`, `C` or `G`. If not recognized, simply {@link Color#GRAY}.
 *
 * @param base the base
 * @return the {@link Color}
 */
public static final Color baseToColor(final char base) {
    switch (base) {
        case 'A':
            return Color.rgb(230, 245, 201);
        case 'T':
            return Color.rgb(244, 202, 228);
        case 'C':
            return Color.rgb(203, 213, 232);
        case 'G':
            return Color.rgb(253, 205, 172);
        default:
            return Color.GRAY;
    }
}
 
開發者ID:ProgrammingLife2017,項目名稱:hygene,代碼行數:22,代碼來源:Node.java

示例6: init

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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:28,代碼來源:ColorPickerDemo.java


注:本文中的javafx.scene.paint.Color.GRAY屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。