Computer Science

Consider the following application files:

import java.awt.*;
import javax.swing.*;
public class DisplayWindow extends JFrame{

private Container c;

public DisplayWindow(){
c = this.getContentPane();

public void addPanel(JPanel p){

public void showFrame(){


public class CityTester {
public static void main(String[] args){
DisplayWindow display = new DisplayWindow();
CityPanel p = new CityPanel();

For this assignment you are to create a graphical program that, with user interaction, visually simulates the path of the sun over a city skyline.

Your job for this assignment is to duplicate this behavior with your own graphical application, complete with "time" labels beneath each sun position. Your application should include two classes, a CityTester driver class, given above, and a CityPanel class, which you must write in its entirety and submit below. The class you submit must be named CityPanel, and your submission should include not only the class text, but also all of the necessary import statements to make the class function properly.

Finally, the "skyline" we show in the running version,above, displays just two buildings, and is pathetic. The skyline in your version should be more ambitious, and should include at least four buildings, maybe a planetarium, perhaps a crane, whatever.

Your task, then, is to write the CityPanel class.
Enter the code for your CityPanel class in the box below.

  1. 👍 0
  2. 👎 0
  3. 👁 150
asked by Sally

Respond to this Question

First Name

Your Response

Similar Questions

  1. Java Panel Problem

    I am supose to draw a grid and center it with a 10 pix border all the way around it. I have done this but no matter what I do I cannot get a 10 pix border. Here is my code. You will notice i have added 20 to the setsize param to

    asked by Robert on December 19, 2009
  2. Java help please

    I am trying to run the following program and am getting this error: java.util.InputMismatchException import*; import java.util.*; public class Pre2 { static Scanner console = new Scanner(; public static void

    asked by Mike on March 2, 2008
  3. Computer Science-Java

    Hi, I am writing an application class for a Lunar Calendar I created in a service class and I have to make sure it is able to detect that the year entered is not in the range of values(I have done this in the service class using a

    asked by Lisa on November 3, 2009
  4. Computer Science Computer Programming

    Please help! I cannot figure out what I am doing wrong. I cannot get the correct output when I run the system. Here is what I have entered in to Netbeans IDE: package shippingcharges; public class ShippingCharges { private double

    asked by AB on May 21, 2012
  5. computers

    Need help with writing an imageJ plugin which is in java. Here is the question: Create an ImageJ plugin for 8-bit grayscale images of arbitrary size that paints a white frame (with pixel value 255) 10 pixels wide into the image.

    asked by Billy on February 25, 2011
  6. pseudo code algorithm

    Convert your algorithm from Question One into a complete Java application. Marks will be allocated based upon: ● Your Java code matching your pseudo code algorithm from Question One. ● Your Java code being syntactically

    asked by husanpreet on April 27, 2016
  7. programming

    Can anyone help me with this really confusing programming problem? The board game scrabble works by assigning points to wooden tiles arranged in cells on a board. We'll simplify this considerably, and consider the following

    asked by Jeff on November 24, 2009
  8. Java

    I am supposed to convert a program i already made into a Java console application that uses the Scanner class to read the user's input. This is the code i have that i need to convert. I don't know where to start. Here is the code

    asked by Thanh on July 14, 2009
  9. Programming

    Hi, I'm new to Java. I've been working on this question, wrote the code and checked the results with some examples and it seems to be doing fine. I would be glad if any of the teachers can check the code for me. Also, please do

    asked by Ashley on October 3, 2019
  10. Java programming

    Okay so I am rewrite the program and it's still not coming right can anyone help me see what's going wrong here please I have to turn this in by tmw so here the program The following program is supposed to read two numbers from a

    asked by Poohboi on July 30, 2016

More Similar Questions