This discussion is archived
3 Replies Latest reply: Oct 25, 2012 8:04 AM by David Grieve RSS

css problem

kapac Newbie
Currently Being Moderated
Hi;
i try to study the javafx CSS reference guide red rectangle example and i made the following code with the copied test.css in src folder
public class Mymedia8 extends Application {
    
    @Override
  public void start(Stage primaryStage) {
      Scene scene = new Scene(new Group());
scene.getStylesheets().add("test.css");
Rectangle rect = new Rectangle(100,100);
rect.setLayoutX(50);
rect.setLayoutY(50);
rect.getStyleClass().add("my-rect");
((Group)scene.getRoot()).getChildren().add(rect);  
 primaryStage.setScene(scene);
    primaryStage.show();
  }
    public static void main(String[] args) {
        launch(args);
    }
} 
and i get the error test.css not found i don't understand;please help
regards

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points