EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
8th Edition
ISBN: 9781305480537
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
bartleby

Concept explainers

bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 15, Problem 1PE

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...

Blurred answer
Students have asked these similar questions
Create a JavaFX application with at least six labels that contain facts about your favorite topic—for example, the French Revolution or astronomy. Every time the user clicks a Button, remove one of the Labels and add a different one.
Write a JavaFX application that creates polyline shapes dynamically using mouse clicks. Each mouse click adds a new line segment to the current polyline from the previous point to the current mouse position. Allow the user to end the current polyline with the double click. And provide a button that clears the window and allows the user to begin again.
You must create JavaFX GUIs by hand coding them in Java. State whether the statement is true or false. If false, explain why.

Chapter 15 Solutions

EBK JAVA PROGRAMMING

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781337671385
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
    Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781305480537
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Time Complexity Analysis - How To Calculate Running Time | InterviewBit; Author: InterviewBit;https://www.youtube.com/watch?v=--oxG4Q1PA0;License: Standard YouTube License, CC-BY