Last active
March 26, 2021 09:41
-
-
Save KingC100/8040948 to your computer and use it in GitHub Desktop.
JavaFX background-color
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FXErycton extends Application { | |
@Override | |
public void start(Stage stage) throws Exception { | |
Parent root = FXMLLoader.load(getClass().getResource("FXErycton.fxml")); | |
root.setStyle("-fx-background-color: #F0591E;"); | |
Scene scene = new Scene(root); | |
stage.setTitle("FXErcycton v1.0.0"); | |
stage.setScene(scene); | |
stage.show(); | |
} |
Thanx... Worked for me too
I've googled a lot how to do this with java code:
Here is the answer:
panel.setBackground(new Background(new BackgroundFill(Color.RED, CornerRadii.EMPTY, Insets.EMPTY)));
@hydroid7 you can also pass null args instead of CornerRadii and Insets, I think it's easier to read
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, just what I was looking for! ;)