Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this assignment you are to create an interactive moving sign in the context of a cityscape street scene. Click the link below to see

For this assignment you are to create an interactive moving sign in the context of a cityscape street scene. Click the link below to see how a base version of this assignment works. Type a message in the long blank slot at the top left, and then click Start to see the message displayed in a moving format. Moving Sign Example The driver and DisplayWindow classes, which you may NOT alter, are provided here: /JavaCS1/src/movingsign/SignDriver.java /JavaUtil/src/owl/common/DisplayWindow.java Note that the application will makes use of the DisplayWindow class that figures prominently in Chapters 12 and 13 of the textbook. For this assignment you need only submit a single file, MovingSignPanel.java (must be so named), which extends JPanel in the standard way, and which carries out the main actions of the assignment. Other issues * The cityscape presented above in the running demonstration code is pathetic - there's just one building, no sky to speak of, etc. You are encouraged to vastly improve on the rendering of the cityscape. Ideas: more buildings; the sky can become lighter or darker over time; lights can go on in some of the windows in the buildings; you could add a park, a flagpole, the sun, the moon, cars, flying saucers; you can make the sign move faster or slower, and so forth. * The SignDriver code includes machinery for including a menu or menus in your application. You DO NOT need to use this machinery. But if you decide to add menus, it's there. Submit your MovingSignPanel code in the box below. Code must be commented. Note that we provide the necessary import statements; do NOT include such statements in the code you submit.

image text in transcribedimage text in transcribedimage text in transcribed

import javax.swing.*; /* Menu machinery provided, but you are free * to ignore it if your solution does not involve menus */ public class SignDriver { public static void main(String[] args) { DisplayWindow d = new DisplayWindow(); JMenuBar menuBar = new JMenuBar(); // make menu bar d.setJMenuBar(menuBar); // add menu bar to window d MovingSignPanel p = new MovingSignPanel(menuBar); d.addPanel(p); d.showFrame(); } }

import javax.swing.*; import java.awt.*; /** * A class that puts a graphics window on your display */ public class DisplayWindow extends JFrame { /** * Content pane that will hold the added Jpanel */ private Container c; /** * DisplayWindow constructor - no parameters */ public DisplayWindow() { super("Display"); c = this.getContentPane(); } /** * Adds panel to content pane * * @parameter the panel to be added */ public void addPanel(JPanel p) { c.add(p); } /** * consolidates the frame, makes it visible, causes program termination when * window is closed manually */ public void showFrame() { this.pack(); this.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }

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

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions