EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
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.
Create JavaFX application that displays similar picture. You can use your own color palette. You do not have to match sizes exactly.
Using java programming language: Create frame 400x200, then create a button that's 200x200 and panel next to it that is 200x200 . On panelt there's number 0, and every time you click the button, the number increments.

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
    Microsoft Visual C#
    Computer Science
    ISBN:9781337102100
    Author:Joyce, Farrell.
    Publisher:Cengage Learning,
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
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Time Complexity Analysis - How To Calculate Running Time | InterviewBit; Author: InterviewBit;https://www.youtube.com/watch?v=--oxG4Q1PA0;License: Standard YouTube License, CC-BY