I am working on an a Java FX program where I have to make an emoji face. I have got the circle made with a border, the eyes and the frown. I am having a problem with the eyebrows. I have one of the eyebrows set in place but I can't seem to get the other eyebrow to match on the other side of the face. This is my first JavaFX program so I have very limited knowledge and the textbook I have is not very good. Anything would be helpful. The eyebrows are line1 and line2.
package application;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.paint.Color;
import javafx.scene.shape.Arc;
import javafx.scene.shape.ArcType;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Line;
public class TracyAssignment2Chap14 extends Application {
@Override
public void start(Stage primaryStage) {
try {
Circle circle = new Circle();
Circle circle2 = new Circle();
Circle circle3 = new Circle();
circle.setCenterX(220.0);
circle.setCenterY(220.0);
circle.setRadius(190.0);
circle.setFill(Color.YELLOW);
circle.setStrokeWidth(15.0);
circle.setStroke(Color.BLACK);
circle2.setCenterX(300.0);
circle2.setCenterY(215.0);
circle2.setRadius(25.0);
circle2.setFill(Color.BLACK);
circle3.setCenterX(150.0);
circle3.setCenterY(215.0);
circle3.setRadius(25.0);
circle3.setFill(Color.BLACK);
Arc arc = new Arc(220,310,80,60,0,180);
arc.setFill(null);
arc.setStroke(Color.BLACK);
arc.setStrokeWidth(15.0);
arc.setType(ArcType.OPEN);
Line line1= new Line();
line1.setStartX(180.0);
line1.setStartY(180.0);
line1.setEndX(150.0);
line1.setEndY(160.0);
line1.setStrokeWidth(15.0);
line1.setStroke(Color.BLACK);
Line line2 = new Line ();
line2.setStartX(200.0);
line2.setStartY(180.0);
line2.setEndX(270.0);
line2.setEndY(160.0);
line2.setStrokeWidth(15.0);
line2.setStroke(Color.BLACK);
Group root = new Group(circle,circle2,circle3,arc,line1,line2);
Scene scene = new Scene(root,450,450);
primaryStage.setTitle("Emoji Assignment");
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
//add the scene to the stage
primaryStage.setScene(scene);
//show the contents of the stage
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}
See Question&Answers more detail:os