Skip to main content

Can someone help me with java?

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
douboc
Offline
Joined: 2010-12-28

Hello, i'm currently studing Computer science in high school (grade 11) but i've noticed all year we've learned with "console" (ready to program) instead of classes and stuff like that (i don't really understand). Now our end project is to make a christmas scene with anaimations. I was wondering if someone can look at my code and tell me how to import picture and then make them move, also make things change colors. Thanks you soo much!

// myname
// Computer Science
// The "Yearendprojectversionone" class.
import java.awt.*;
import hsa.Console;
import java.lang.Object;
import java.awt.Color;

public class Yearendprojectversionone
{
static Console c; // The output console

public static void main (String[] args)
{
c = new Console ();
//the sky and the background's main color
c.fillRect (0, 0, 1000, 300);
c.setColor (Color.lightGray);
//the house
c.fillRect (100, 200, 200, 100);
//chimney
c.fillRect (230, 120, 20, 40);
//the roof
c.fillOval (100, 150, 200, 100);
//outlines of the house
c.setColor (Color.black);
c.fillRect (100, 200, 200, 2);
//windows and doors
c.setColor (Color.black);
c.drawRect (130, 220, 30, 30);
c.drawRect (145, 220, 1, 30);
c.drawRect (230, 220, 30, 30);
c.drawRect (245, 220, 1, 30);
c.drawOval (180, 160, 30, 30);
c.drawRect (195, 160, 1, 30);
c.drawRect (180, 175, 30, 1);
//door
c.fillRect (190, 260, 20, 40);
//Christmas tree
c.setColor (Color.orange);
c.fillRect (500, 230, 30, 70);
c.setColor (Color.green);
c.fillArc (465, 180, 100, 180, 0, 180);
//road on street
c.setColor (Color.gray);
c.fillRect (190, 300, 20, 100);
c.fillRect (0, 400, 900, 20);
//starts
c.setColor (Color.yellow);
c.fillRect (30, 20, 10, 1);
c.fillRect (35, 15, 1, 10);
c.fillRect (30, 20, 10, 1);
c.fillRect (35, 15, 1, 10);
c.fillRect (140, 25, 10, 1);
c.fillRect (145, 20, 1, 10);
c.fillRect (140, 25, 10, 1);
c.fillRect (145, 20, 1, 10);
c.fillRect (230, 50, 10, 1);
c.fillRect (235, 45, 1, 10);
c.fillRect (230, 50, 10, 1);
c.fillRect (235, 45, 1, 10);
c.fillRect (330, 60, 10, 1);
c.fillRect (335, 55, 1, 10);
c.fillRect (330, 60, 10, 1);
c.fillRect (335, 55, 1, 10);
c.fillRect (280, 10, 10, 1);
c.fillRect (285, 5, 1, 10);
c.fillRect (280, 10, 10, 1);
c.fillRect (285, 5, 1, 10);
c.fillRect (110, 40, 10, 1);
c.fillRect (115, 35, 1, 10);
c.fillRect (110, 40, 10, 1);
c.fillRect (115, 35, 1, 10);
//moon
c.fillOval (550, 0, 100, 100);
// Place your program here. 'c' is the output console
} // main method

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
walter1982
Offline
Joined: 2011-01-06

it's so long . if you want learn java,why not go there http://java-er.com