My primary class is as follows:
public class Digital_Analog_Clock_Beta_1 extends Application
{
@Override
public void start(Stage primaryStage)
{
double outerBoxWidth = 500, outerBoxHeight = outerBoxWidth / 2.5;
Rectangle outerBox = new Rectangle(0, 0, outerBoxWidth, outerBoxHeight);
outerBox.setId("outer-box");
Rectangle part1 = new Rectangle(0, 0, outerBoxWidth * .35, outerBoxHeight);
part1.setId("partition");
Rectangle part2 = new Rectangle(outerBoxWidth * .35, 0, outerBoxWidth * .05, outerBoxHeight);
part2.setId("partition-alternate");
Rectangle part3 = new Rectangle(outerBoxWidth * .4, 0, outerBoxWidth * .35, outerBoxHeight);
part3.setId("partition");
Rectangle part4 = new Rectangle(outerBoxWidth * .75, 0, outerBoxWidth * .35, outerBoxHeight);
part4.setId("partition-alternate");
double bigNumWidth = outerBoxWidth * .35;
double digitWidth = (.9 * bigNumWidth / 2) * 0.95;
double digitHeight = .9*outerBoxHeight;
Digit Digit1 = new Digit(outerBoxWidth*.1,outerBoxHeight*.1,digitWidth,digitHeight);
Digit1.bottom.setId("digits");
Digit1.c.setFill(Color.AQUA);
Pane pane = new Pane();
pane.getChildren().add(outerBox);
pane.getChildren().addAll(part1, part2, part3, part4);
//pane.setId("background");
pane.getChildren().add(Digit1);
Scene scene = new Scene(pane, outerBoxWidth, outerBoxHeight);
scene.getStylesheets().add(getClass().getResource("styleSheet.css").toExternalForm());
primaryStage.setTitle("Digital Analog Clock Beta 1");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args)
{
launch(args);
}
}
Below is my Digit class :
public class Digit extends Pane
{
double startX, startY, digitWidth, digitHeight, lineWidth;
public Digit(double startX, double startY, double digitWidth, double digitHeight)
{
this.startX = startX;
this.startY = startY;
this.digitWidth = digitWidth;
this.digitHeight = digitHeight;
lineWidth = digitHeight / 20;
getChildren().addAll(top,middle,bottom,upperLeft,upperRight,lowerLeft,lowerRight, c);
}
Polygon top = new Polygon(startX, startY, startX + digitWidth, startY, startX + digitWidth - lineWidth, startY + lineWidth * .95, startX + lineWidth, startY + lineWidth * .95);
Polygon middle = new Polygon(startX + lineWidth, startY + digitHeight / 2 - lineWidth / 2 + lineWidth * .05,
startX + digitWidth - lineWidth, startY + digitHeight / 2 - lineWidth / 2 + lineWidth * .05,
startX + digitWidth - lineWidth * .05, startY + digitHeight, startX + digitWidth - lineWidth, startY + digitHeight / 2 + lineWidth / 2 - lineWidth * .05,
startX + lineWidth, startY + digitHeight / 2 + lineWidth / 2 - lineWidth * .05, startX + lineWidth * .05, startY + digitHeight / 2);
Polygon bottom = new Polygon(startX, startY + digitHeight, startX + digitWidth, startY + digitHeight, startX + digitWidth - lineWidth, startY + digitHeight - lineWidth * .95,
startX + lineWidth, startY + digitHeight - lineWidth * .95);
Polygon upperLeft = new Polygon(startX, startY, startX + lineWidth * .95, startY + lineWidth, startX + lineWidth * .95, startY + digitHeight / 2 - lineWidth / 2, startX, startY + digitHeight / 2);
Polygon lowerLeft = new Polygon(startX, startY + digitHeight / 2, startX + lineWidth * .95, startY + digitHeight / 2 + lineWidth / 2, startX + lineWidth * .95, startY + digitHeight - lineWidth,
startX, startY + digitHeight);
Polygon upperRight = new Polygon(startX + digitWidth, startY, startX + digitWidth, startY + digitHeight / 2, startX + digitWidth - lineWidth * .95, startY + digitHeight / 2 - lineWidth / 2,
startX + digitWidth - lineWidth * .95, startY + lineWidth);
Polygon lowerRight = new Polygon(startX+digitWidth,startY+digitHeight/2,startX+digitWidth,startY+digitHeight,startX+digitWidth-lineWidth*.95,startY+digitHeight-lineWidth,
startX+digitWidth-lineWidth*.95,startY+lineWidth/2+digitHeight/2);
Circle c = new Circle(100.0f,100.0f,1000.0f);
}
And here's the styleSheet.css :
#outer-box
{
-fx-fill: #353839; /* Onyx */
}
#outer-box-t
{
-fx-fill: rgba(0,0,0,0); /* transparent */
}
#partition
{
-fx-fill: rgba(200,200,205,0.25) /* #C8C8CD Blue Grey a : 0.5*/
}
#partition-alternate
{
-fx-fill: rgba(0,0,0,0); /* transparent i.e. Onyx */
}
#background
{
-fx-background-color: #C53151; /* Dingy Dungeon */
}
#digits
{
-fx-fill : #66FF66; /* Screamin' Green */
-fx-stroke: #C53151; /* Dingy Dungeon */
-fx-stroke-width : 3;
}
Output window can be seen https://i.sstatic.net/VEh2E.jpg
The digits are meant to appear over the background I have created. The numerous rectangles in the main class serve the purpose of spacing out the digits accordingly. Although I added polygons and even a circle at the bottom of my Digit.java class, they do not show up in the output window. Having asked a similar question on Stack Overflow previously, it worked for a test case but not in this actual program.
Update: Everything except for the circle is missing from the output window.