• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Drawing Canvas

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello everyone .. well this my second course in have java programming and im really lost i don't have the simplest clue to how do it so im seeking some help .. well below is my program and im using net beans to program it .. i really would be regretful if someone dropped some hints here and there ...

thank you

1 Drawing Canvas
Computer images are made of small colored elements called pixels. An image is therefore
a two-dimentional table of pixels. Each pixel has three color components that specify
the pixel’s red, green, and blue values (this is commonly called an RGB color). Each
component can have any value from 0 to 255 inclusive.
A pixel is an object of a Pixel class. A Pixel class has a constructor that takes the three
RGB color values and has three accessors named red, green, and blue. The Pixel class
is immutable: this means that none of its fields can be changed once a pixel is created.
In the Pixel class, override the methods equals and hashCode that are defined in the
root class Object.
All images must implement the Image interface specified as follows:
public interface Image {
public int width();
public int height();
public Pixel getPixel(int x, int y);
}
Note that the origin (0,0) point in a computer image is the upper-left corner of the image,
the x axis extends to the right, and the y axis extends downwards.
A mutable image is an image that also provides a setter operation setPixel. The interface
of MutableImage is as follows:
public interface MutableImage extends Image {
public void setPixel(int x, int y, Pixel p);
}
Write the code for a Canvas class that implements the MutableImage interface. The constructor
for Canvas should take a width and height parameters (both of which must be
1
positive integers) as well as an initial color (of type Pixel) of all the pixels in the image.
It must create a 2-D array of pixels with the given dimentions and fills the array with
the given pixel color.[/size]
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
zainab, welcome to the Ranch! We don't have too many rules here, but we do ask that you BeForthrightWhenCrossPostingToOtherSites
http://au.answers.yahoo.com/question/index?qid=20120219112354AADQao2

We would also like you to ShowSomeEffort ... you might like to go through some more of the sage advice on How To Ask Questions On Java Ranch.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic