1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ahat [919]
4 years ago
11

In this assignment, you will write a user interface for your calculator using JavaFX. Your graphical user interface (GUI) should

look like the screenshot below (creativity is good, but you also need to be able to design to customer specifications). When the user closes the window, the program should end. For this assignment the GUI does not need to respond to any other user input. Note that we are developing this GUI completely separately from any class. This is a common design pattern that is often called ModelView-Controller, or MVC. The model is the data your program deals with, the view is the user interface, and the controller responds to input from the view by acting on the data in the model. Developing programs in this way allows you to create diffe

Engineering
1 answer:
Zolol [24]4 years ago
4 0

Answer:

Kindly note that, you're to replace "at" with shift 2 as the brainly text editor can't take the symbol

Explanation:

import javafx.application.Application;

import javafx.stage.Stage;

import javafx.scene.Group;

import javafx.scene.Scene;

import javafx.scene.layout.VBox;

import javafx.scene.layout.HBox;

import javafx.scene.control.TextField;

import javafx.scene.control.Button;

public class Calculator extends Application {

public static void main(String[] args) {

// TODO Auto-generated method stub

launch(args);

}

"at"Override

public void start(Stage primaryStage) throws Exception {

// TODO Auto-generated method stub

Group root = new Group();

VBox mainBox = new VBox();

HBox inpBox = new HBox();

TextField txtInput = new TextField ();

txtInput.setEditable(false);

txtInput.setStyle("-fx-font: 20 mono-spaced;");

txtInput.setText("0.0");

txtInput.setMinHeight(20);

txtInput.setMinWidth(200);

inpBox.getChildren().add(txtInput);

Scene scene = new Scene(root, 200, 294);

mainBox.getChildren().add(inpBox);

HBox rowOne = new HBox();

Button btn7 = new Button("7");

btn7.setMinWidth(50);

btn7.setMinHeight(50);

Button btn8 = new Button("8");

btn8.setMinWidth(50);

btn8.setMinHeight(50);

Button btn9 = new Button("9");

btn9.setMinWidth(50);

btn9.setMinHeight(50);

Button btnDiv = new Button("/");

btnDiv.setMinWidth(50);

btnDiv.setMinHeight(50);

rowOne.getChildren().addAll(btn7,btn8,btn9,btnDiv);

mainBox.getChildren().add(rowOne);

HBox rowTwo = new HBox();

Button btn4 = new Button("4");

btn4.setMinWidth(50);

btn4.setMinHeight(50);

Button btn5 = new Button("5");

btn5.setMinWidth(50);

btn5.setMinHeight(50);

Button btn6 = new Button("6");

btn6.setMinWidth(50);

btn6.setMinHeight(50);

Button btnMul = new Button("*");

btnMul.setMinWidth(50);

btnMul.setMinHeight(50);

rowTwo.getChildren().addAll(btn4,btn5,btn6,btnMul);

mainBox.getChildren().add(rowTwo);

HBox rowThree = new HBox();

Button btn1 = new Button("1");

btn1.setMinWidth(50);

btn1.setMinHeight(50);

Button btn2 = new Button("2");

btn2.setMinWidth(50);

btn2.setMinHeight(50);

Button btn3 = new Button("3");

btn3.setMinWidth(50);

btn3.setMinHeight(50);

Button btnSub = new Button("-");

btnSub.setMinWidth(50);

btnSub.setMinHeight(50);

rowThree.getChildren().addAll(btn1,btn2,btn3,btnSub);

mainBox.getChildren().add(rowThree);

HBox rowFour = new HBox();

Button btnC = new Button("C");

btnC.setMinWidth(50);

btnC.setMinHeight(50);

Button btn0 = new Button("0");

btn0.setMinWidth(50);

btn0.setMinHeight(50);

Button btnDot = new Button(".");

btnDot.setMinWidth(50);

btnDot.setMinHeight(50);

Button btnAdd = new Button("+");

btnAdd.setMinWidth(50);

btnAdd.setMinHeight(50);

rowFour.getChildren().addAll(btnC,btn0,btnDot,btnAdd);

mainBox.getChildren().add(rowFour);

HBox rowFive = new HBox();

Button btnEq = new Button("=");

btnEq.setMinWidth(200);

btnEq.setMinHeight(50);

rowFive.getChildren().add(btnEq);

mainBox.getChildren().add(rowFive);

root.getChildren().add(mainBox);

primaryStage.setScene(scene);

primaryStage.setTitle("GUI Calculator");

primaryStage.show();

}

}

You might be interested in
Match the scenario to the related government program.
Rashid [163]

Answer:

3. A team designs an arid-zone shade structure from political campaign sign

4 0
3 years ago
A developer is having a single-lane raceway constructed with a 100 mph design speed. A curveon the raceway has a radius of 1000-
Hoochie [10]

Answer:

(a) 36+45.00

(b) 24+65.00  

(c) 6+517.500

(d) 12+324.800

3 0
3 years ago
Read 2 more answers
Please calculate the current for the circuit below
Aleks04 [339]

Answer:

The answer is "I = 0.0085106383 \ A"

Explanation:

Given:

R= 470  \ \Omega \\\\V= 4 \ v

Formula:

\to V=IR\\\\\to I = \frac{V}{R}\\\\

      = \frac{4}{470}\\\\ = 0.0085106383 \ A

3 0
3 years ago
(a) Define a slip system. (b) Cite one slip system for the simple cubic crystal structure. (c) One slip system for the BCC cryst
Lemur [1.5K]

Answer:

I'm gonna say D.

4 0
3 years ago
While at a concert you notice five people in the crowd headed in the same direction. Your tendency to group them is due to? *
Vlada [557]

Answer:

common fate

Explanation:

The gestalt effect may be defined as the ability of our brain to generate the whole forms from the groupings of lines, points, curves and shapes. Gestalt theory lays emphasis on the fact that whole of anything is much greater than the parts.

Some of the principles of Gestalt theory are proximity, similarity, closure, symmetry & order, figure or ground and common fate.

Common fate : According to this principle, people will tend to group things together which are pointed towards or moving in a same direction. It is the perception of the people that objects moving together belongs together.

7 0
3 years ago
Other questions:
  • Explain different types of loads on beam with sketch
    8·1 answer
  • What is the rms current flowing through a light bulb that uses an average power of 60.0 60.0 W when it is plugged into a wall re
    12·1 answer
  • A budding electronics hobbyist wants to make a simple 1.0-nF capacitor for tuning her crystal radio, using two sheets of aluminu
    10·1 answer
  • What change in the sound do you expect to hear when you increase the amplitude of
    14·1 answer
  • A preheater involves the use of condensing steam at 100o C on the inside of a bank of tubes to heat air that enters at I atm and
    14·1 answer
  • The step shaft is subjected to a torque of 710 lb·in. If the allowable shear stress for the material is τallow = 12 ksi, determi
    11·1 answer
  • Sinks must be used for the correct intended purpose to prevent
    7·1 answer
  • How to measure the quality of the output signal in ADC?
    13·1 answer
  • If a soil has e=0.72, moisture content = 12% and Gs=2.72, find the weight of water in KN/m3 to be added to make the soil saturat
    6·1 answer
  • I need ideas of usernames for a 2021 Jeep Wrangler Rubicon!!
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!