Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In my java code I am trying to make a smiling emoji with glasses but I can't get the face to center correctly and it

In my java code I am trying to make a smiling emoji with glasses but I can't get the face to center correctly and it only shows one lense of the glasses instead of two: import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.Group;
import javafx.scene.shape.*;
import javafx.scene.paint.*;
import javafx.stage.Stage;
public class Emoji extends Application {
@Override
public void start(Stage stage) throws Exception {
Color c = Color.rgb(225,171,0);
Circle circle = new Circle();
circle.setCenterX(100);
circle.setCenterY(100);
circle.setRadius(90);
circle.setFill(c);
Circle c2= new Circle();
c2.setCenterX(140);
c2.setCenterY(80);
c2.setRadius(30);
c2.setFill(Color.TRANSPARENT);
c2.setStroke(Color.BLACK);
c2.setStrokeWidth(5);
Circle c3= new Circle();
c3.setCenterX(140);
c3.setCenterY(80);
c3.setRadius(30);
c3.setFill(Color.TRANSPARENT);
c3.setStroke(Color.BLACK);
c3.setStrokeWidth(5);
Arc ar = new Arc();
ar.setCenterX(100);
ar.setCenterY(110);
ar.setRadiusX(45);
ar.setRadiusY(45);
ar.setType(ArcType.OPEN);
ar.setFill(Color.TRANSPARENT);
ar.setStroke(Color.BROWN);
ar.setStrokeWidth(5);
Line line11= new Line(90,80,110,80);
Ellipse el = new Ellipse();
el.setCenterX(64.0f);
el.setCenterY(80.0f);
el.setRadiusX(10.0f);
el.setRadiusY(13.0f);
el.setFill(Color.BROWN);
Ellipse e2= new Ellipse();
e2.setCenterX(135.0f);
e2.setCenterY(80.0f);
e2.setRadiusX(10.0f);
e2.setRadiusY(13.0f);
e2.setFill(Color.BROWN);
Group g = new Group();
g.getChildren().addAll(circle, c2, c3, ar, line11, el, e2);
Scene scene = new Scene(g,300,400);
stage.setScene(scene);
stage.setTitle("Emoji");
stage.show();
}
public static void main(String[] args){
Application.launch(args);
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions