JavaFX CSS styling 🎨
118.6K views on YouTube
JavaFX CSS styling tutorial example explained
#javafx #css #style
//—————————-Main.java—————————–
package application;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;
import javafx.scene.Parent;
import javafx.scene.Scene;
public class Main extends Application {
@Override
public void start(Stage stage) {
try {
Parent root = FXMLLoader.load(getClass().getResource(“Main.fxml”));
Scene scene = new Scene(root);
//scene.getStylesheets().add(getClass().getResource(“application.css”).toExternalForm());
String css = this.getClass().getResource(“application.css”).toExternalForm();
scene.getStylesheets().add(css);
stage.setScene(scene);
stage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}
//—————————-application.css—————————–
.root{
-fx-background-color: #111111;
}
.label{
-fx-font-size: 40;
-fx-font-family: “Lucida Console”;
-fx-text-fill: “white”;
-fx-alignment: center;
}
#titleLabel{
-fx-font-size: 70;
}
//———————————————————————————
Bro Code merch store 👟 :
===========================================================
https://teespring.com/stores/bro-code-5
===========================================================
music credits 🎼 :
===========================================================
Up In My Jam (All Of A Sudden) by – Kubbi https://soundcloud.com/kubbi
Creative Commons — Attribution-ShareAlike 3.0 Unported— CC BY-SA 3.0
Free Download / Stream: http://bit.ly/2JnDfCE
Music promoted by Audio Library https://youtu.be/tDexBj46oNI
===========================================================