0% found this document useful (0 votes)
4 views

doc_Drawing

Uploaded by

Dams
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

doc_Drawing

Uploaded by

Dams
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

fr.lacl.

cpo

Class Drawing

 java.lang.Object

 fr.lacl.cpo.Drawing

public class Drawing


extends Object

An instance of this class represents a window which can be drawn upon using its
methods.

 Constructor Summary

Constructors
Constructor and Description

Drawing(String title, int width, int height)


Creates a new window of specified size and title.

Drawing(String title, int width, int height, boolean backBuffered)


Creates a new window of specified size and title.

 Method Summary

All MethodsInstance MethodsConcrete Methods


Modifier and Type Method and Description

void clear()
Clears the drawing.

void line(double x1, double y1, double x2, double y2)


Draws a line between the specified points.

void point(double x, double y)


Draws a point at specified location.

void setColor(double red, double green, double blue)


Sets the color of the pencil.

void setWidth(double strokeWidth)


Sets the line or point thickness.

voidp swap()
Swaps between the back buffer and the front buffer.
 Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, noti


fyAll, toString, wait, wait, wait

 Constructor Detail

 Drawing

 public Drawing(String title,


 int width,
int height)

Creates a new window of specified size and title. Calling this


instance's methods allows to draw on the window.
Parameters:
title - the title of the window.
width - the width of the window.
height - the height of the window.

 Drawing

 public Drawing(String title,


 int width,
 int height,
boolean backBuffered)

Creates a new window of specified size and title. Calling this


instance's methods allows to draw on the window.
Parameters:
title - the title of the window.
width - the width of the window.
height - the height of the window.
backBuffered - indicates if the window is back-buffered
(see swap() method).

 Method Detail

 setColor

 public void setColor(double red,


 double green,
double blue)

Sets the color of the pencil.


Parameters:
red - the amount of red in [0,1].
green - the amount of green in [0,1].
blue - the amount of blue in [0,1].

 setWidth

public void setWidth(double strokeWidth)

Sets the line or point thickness.


Parameters:
strokeWidth - the thickness.

 point

 public void point(double x,


double y)

Draws a point at specified location.


Parameters:
x - abscissa of the point to draw.
y - ordinate of the point to draw.

 line

 public void line(double x1,


 double y1,
 double x2,
double y2)

Draws a line between the specified points.


Parameters:
x1 - abscissa of the first point.
y1 - ordinate of the first point.
x2 - abscissa of the second point.
y2 - ordinate of the second point.

 clear

public void clear()

Clears the drawing.


 swap

public void swap()

Swaps between the back buffer and the front buffer. This makes all
the changes made after the last call to the swap method visible.

You might also like