Apuntes
Graphics class
Contenido del apunte (3)
Página 1
Graphics class
Graphics class include methods for drawing shapes from a single line to a polygon.
To text in different fonts.
To draw a shape on the screen we may call one of the methods available in the graphics class.
Página 2
Graphics Methods
drawLine(x1,y1,x2,y2)
drawOval(x,y,height,width)
fillOval(x,y,height,width)
drawRect(top,left,width,height)
fillRect(top,left,width,height)
roundRect(int top,int left,int width,int height,int xdimension,int ydimension)
fillRoundRect(int top,int left,int width,int height,int xdimension,int ydimension)
drawArc(int top,int left,int width,int height,int start angle,int sweep angle)
fillArc(int top,int left,int width,int height,int start angle,int sweep angle)
drawPolygon(int x[],int y[],int no.of points)
fillPolygon(int x[],int y[],int no.of points)
drawString("string",x,y)
Página 3
Sample Program
import java.awt.*;
import java.applet.*;
/*<applet code=abc height=100 width=100>
</applet>*/
public class abc extends Applet
{
public void paint(Graphics g1)
{
g1.drawOval(20,20,100,100);
g1.setColor(Color.green);
g1.fillOval(70,20,100,100);
}
}
Información
- Descripción
- JAVA Apunte sobre Graphics class, creado por shanid m el 10/10/2016.
- Creado por
- shanid m
- Visitas
- 0
- Valoración