Skip to content

Commit

Permalink
Fix Stylesheet
Browse files Browse the repository at this point in the history
* add style example
  • Loading branch information
brp14005 committed Feb 7, 2016
1 parent 0797c55 commit 80aeeaa
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/main/java/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class Controller{

@FXML
private void initialize() {
createTree();
// createTree();
}

// Create the directory Tree
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{

setUserAgentStylesheet(STYLESHEET_CASPIAN);
// setUserAgentStylesheet(STYLESHEET_CASPIAN);
/* Button btn = new Button();
btn.setText("This is a test");
btn.setOnAction(new EventHandler<ActionEvent>() {
Expand All @@ -24,13 +24,12 @@ public void handle(ActionEvent event) {
});*/

Parent root = FXMLLoader.load(getClass().getResource("StartPage.fxml"));
Scene scene = primaryStage.getScene();
Rectangle2D screenBounds = Screen.getPrimary().getVisualBounds();

//scene.getStylesheets().add("style_main.css"); //Error here...

primaryStage.setTitle("Iron-gate!");
primaryStage.setScene(new Scene(root, screenBounds.getWidth(), screenBounds.getHeight()));
primaryStage.setScene(new Scene(root, screenBounds.getWidth(), screenBounds.getHeight())); // a scene is created here
Scene scene = primaryStage.getScene(); // we get the scene from above
scene.getStylesheets().clear(); // clear any styles
scene.getStylesheets().add("/main/resources/mainStyle.css"); // absolute path
primaryStage.show();
}
public static void main(String[] args) {
Expand Down
34 changes: 34 additions & 0 deletions src/main/resources/mainStyle.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

/*
Document : controlStyle1
*/

.root{
-fx-font-size: 14pt;
-fx-font-family: "Tahoma";
-fx-base: #DFB951;
-fx-background: #A78732;
-fx-focus-color: #B6A678;
}

.button1{
-fx-text-fill: #006464;
-fx-background-color: #DFB951;
-fx-border-radius: 20;
-fx-background-radius: 20;
-fx-padding: 5;
}

.button2{
-fx-text-fill: #c10000;
-fx-background-color: #DFB951;
-fx-border-radius: 20;
-fx-background-radius: 20;
-fx-padding: 5;
}

.slider{
-fx-border-color: white;
-fx-border-style: dashed;
-fx-border-width: 2;
}

0 comments on commit 80aeeaa

Please sign in to comment.