“Javafx -Schaltfläche Farbe” Code-Antworten

Javafx -Schaltfläche Farbe

//making a red button in javafx

Button button = new Button("My Button");
button.setStyle("-fx-background-color: #ff0000; ");
Mocat

Javafx ändern die Schaltfläche Hintergrundfarbe

/*can address these properties: */
-fx-border-width
-fx-border-color
-fx-background-color
-fx-font-size
-fx-text-fill

/*	see source for more examples
	see JavaFX CSS Reference Guide for additional properties:
	https://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html
*/
Solstice

Javafx -Schaltfläche Farbe


ToggleButton btn = new ToggleButton("Say 'Hello World'");
btn.setOnAction((ActionEvent event) -> {
    System.out.println("Hello World!");
});

...
scene.getStylesheets().add(getClass().getResource("style.css").toExternalForm());

Cute Cobra

cgange Hintergrund von Schaltfläche Klicken Sie auf Java FX

BackgroundImage backgroundImage = new BackgroundImage( new Image( getClass().getResource("/testing/background.jpg").toExternalForm()), BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT);
        Background background = new Background(backgroundImage);

        Button button = new Button( "Click me!");
        button.setBackground(background);
Smiling Shrike

Ähnliche Antworten wie “Javafx -Schaltfläche Farbe”

Fragen ähnlich wie “Javafx -Schaltfläche Farbe”

Weitere verwandte Antworten zu “Javafx -Schaltfläche Farbe” auf Java

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen