Concept explainers
Explanation of Solution
Program:
File name: “JMovieFrame.java”
//Import necessary header files
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
/*Define a class named JMovieFrame that extends JFrame
and implements ActionListener */
public class JMovieFrame extends JFrame implements ActionListener
{
/*Create five JButton objects for north, south, east,
west and center */
private JButton northBtn=new JButton("North by NorthWest");
private JButton southBtn=new JButton("Song of South");
private JButton eastBtn=new JButton("East of Eden");
private JButton westBtn=new JButton("Once upon a time in west");
private JButton centerBtn=new JButton("World Trade Center");
private Container container=getContentPane();
//Define a Constructor of the class JMovieFrame
public JMovieFrame()
{
//Set the title
setTitle("JMovieFrame");
//Set the BorderLayout
container.setLayout(new BorderLayout());
//Add north button
container.add(northBtn, BorderLayout.NORTH);
//Add south button
container.add(southBtn, BorderLayout.SOUTH);
//Add west button
container.add(westBtn, BorderLayout.WEST);
//Add east button
container.add(eastBtn, BorderLayout.EAST);
//Add center button
container.add(centerBtn, BorderLayout.CENTER);
//Set width and height
setSize(450, 250);
//Add ActionListener
northBtn.addActionListener(this);
southBtn.addActionListener(this);
westBtn.addActionListener(this);
eastBtn...
Trending nowThis is a popular solution!
Chapter 15 Solutions
EBK JAVA PROGRAMMING
- To create a JavaFx label with the specified text, use __________. Question 11 options: new Labelled(); new JLabel(text); new Label(); new Label(text);arrow_forwardWrite a JavaFX application that allows the user to select a color out of five options provided by a set of radio buttons. Change the color of a displayed square accordingly.arrow_forwardCreate a JavaFX application that implements a short survey. The first question should ask the user for his or her favourite color and present the choices “red”, “orange”, “blue”, and “green” in radio buttons. The second question should ask the user for his or her age and present the choice in a spinner with the range 10–100arrow_forward
- Using Java, Create a JFrame application with a textfield and an OK button. The user types in a number, and presses "OK", your application will get that text, convert it to an int, and display the square of that number in a messagedialog.arrow_forwardWrite a JavaFX application that serves as a mouse odometer, continually displaying how far, in pixels, the mouse has moved whileit is over the program window. Display the current odometervalue at the top of the window. Hint: As the mouse moves, usethe distance formula to calculate how far the mouse has traveledsince the last event, and add that to a running total.arrow_forwardPart 1:1. Write a JavaFX program that create a simple calculator for performing addition, subtraction,multiplication, and division, as shown below. - The grid pane consists of three labels and three text fields, and the flow pan consists of four buttons.- The result text-field is not editable (How can you make a TextField not editable?).- How can you process the buttons’ click events to perform the required basic mathematical operations?- How can you get a text from a TextField?- How can you set a text to a TextField?- How can you convert a String to a double value? How can you use Double.parseDouble() method?arrow_forward
- As a front-end junior developer, you have been assigned to create the following simple interface using JavaFX. Do this, ensuring you document the whole code using single line comments. Populate the ChoiceBox with the following items; Mr, Mrs, Miss, Dr, Prof, Eng and Captarrow_forwardAnalyze the following JavaFX program and complete the missing code based on the comments. The Program should show window like this. public class EmployeeInterface extends Application{ @Override public void start(Stage stage) throws Exception { 1- // Create a boreder Pane object 2- // create HBox object 3- // create the two command button objects 4- // add command buttons in the HBox object 5- // create grid pane object 6- // create the label and TextField for the name and add them in the first row in the grid pane 7- // create the label and TextField for the Major and add them in the first row in the grid pane 8- // Put the commands in the buttom of the BorderPane 9- // Put the GridPane which contain student information in the center of BorderPane 10- // create the Scene Object and it set it as stage…arrow_forwardUsing java swing framework your interface, provide a label and 4 buttons. Initially, your label will display number 0. Use one button to change the display value in increment of 1, and another button to change the display value in decrement of 1. Add two buttons to increase and decrease the font size of the label.arrow_forward
- I'm learning GUI in my java class and we were asked to do this prompt.(we use netbeans and this assignment was with javafx I believe) Draw 2 circles, with their center x values as half of the scene width, and the first circle’s center y as 1/4 of the scene height, and the second circle’s center y as 3/4 of the scene height. You need to bind the circle center locations to the scene size. My code wasn't running so I just scraped the whole thing. Any help is appreciated. Thank you in advance!arrow_forwardUsing JavaFX, create a user interface that has a top bar that includes a menu. The menu should have four items. When the user selects the first menu option, then the date and time should be printed in a text box. When the user selects the second menu option, then the text box contents should be written to a text file named "log.txt." When the user selects the third menu item then the frame background color changes to random color hue of the color green. The menu option should display the initial random hue each time selected for a single execution of the program. See https://www.w3schools.com/colors/colors_picker.aspLinks to an external site. When the user selects the fourth menu option then the program exits.arrow_forwardQuestion 2 write a javafx program for a close button, like in Google Chrome where it is placed on the top right corner to closes a window Full explainthe this question very fast solution sent me step by step Don't ignore any part all part work u Text typing work only not allow paper workarrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT