It was working earlier but now here is a screenshot
of my running program and it is clearly not. Can somebody help me with this? I am a beginner to JavaFX.
Analog_clock.java
package analog_clock;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;
/**
*
* @author ishansrivastava
*/
public class Analog_clock extends Application {
@Override
public void start(Stage primaryStage) {
Circle circle = new Circle();
circle.setCenterX(100.0f);
circle.setCenterY(100.0f);
circle.setRadius(50.0f);
Group g = new Group();
g.getChildren().add(circle);
Pane bg = new Pane();
//bg.setBackground(new Background(new BackgroundFill("-fx-color: #ACACE6", null,null)));
bg.getChildren().add(g);
Scene scene = new Scene(bg, 300, 250);
scene.getStylesheets().add(this.getClass().getResource("style.css").toExternalForm());
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show()cl;
}
public static void main(String[] args) {
launch(args);
}
}
style.css
.Circle
{
-fx-stroke: #757575; /* sonic silver */
-fx-fill: #00CC99; /* caribbean green */
}
.pane
{
-fx-background-color: #ACACE6; /* maximum blue purple */
}
Thank you for helping me out.
update :
after changing my css file to this :
.circle
{
-fx-stroke: #757575; /* sonic silver */
-fx-fill: #00CC99; /* caribbean green */
}
.root
{
-fx-background-color: #ACACE6; /* maximum blue purple */
}
my background appears to be purple where as I have nothing named root in my code.