:
This message was edited by cabrera31086 at 2006-4-5 0:34:19
: : : need help again this is my take home final exam, i dont know where to start... help guys please...
: : :
: : : a. write an applet that displays a city skyline, similar to the drawing shown in figure 7-13. Name the applet Skyline.Java
: : :
: : : [URL=http://img123.imageshack.us/my.php?image=fig0fu.jpg]

http://img123.imageshack.us/img123/6469/fig0fu.th.jpg[/img][/url]
: : :
: : :
http://img123.imageshack.us/img123/6469/fig0fu.jpg
: : :
: : : b. Add a button to the skyline applet. when the user clicks the button, change the sky color from day to night.
: : :
: : : c. Modify the applet created in exercise b so the sky changes from day to night or night to day with each successive button click.
: : :
: : : d. Add a moon to the sky for the night view, and a sun for the day view.
: : :
: : : --- appreciate the help guys thanks...
: : :
: : :
: : : i need it guys in saturday, help me please... thanks...
: : :
: : A: Drawing the skyline can be done using 2 Graphics.fillPoly() calls, each with its own color: 1 for the sky and 1 for the buildings.
: :
: : B: The button should change the color of the key poly to Color.BLUE.
: :
: : C: If you store the color in a object-variable, then you can easily switch between the night and day color, by using an simple if-statement.
: :
: : D: The most basic sun shape is a yellow circle, while the most basic moon shae is a paler yellow/gray circle. If you want to have a traditional non-full moon, you should also draw a night-colored circle partly over the moon circle. This will effectively mask the "invisible" part of the moon.
: :
:
: help me more in the graphics part... i started doing this, here's what i got and i dont know whats next... continue this please, thnx...
:
: import java.applet.*;
: import java.awt.*;
: import java.awt.event.*;
:
: public class Skyline extends Applet implements ActionListener
: {
: Button pressMe = new Button("Press Me");
: int day;
:
: public void init() {
: add(pressMe);
: pressMe.addActionListener(this);
: day = 1;
: }
:
: public void actionPerformed(ActionEvent e)
: {
: if (day == 1)
: day = 0;
: else
: day = 1;
: repaint();
: }
:
:
:
:
:
Next step is to write the paint() method.