Tekenen met java
Auteur: NitroKe - 08 november 2004 - 19:40 - Gekeurd door: Dennisvb - Hits: 5482 - Aantal punten: 0.00 (2 stemmen)
Gemakkelijk om de verschillende tekenopdrachten te onthouden, met hun parameters.
|
Code: |
/*
*
* Tekenen met Java
*
*/
import java.awt.*;
import java.applet.*;
public class Tekenen extends Applet {
public void init() {
}
public void paint(Graphics g) {
g.setColor( Color.red ); // drawRect & fillRect in red.
g.drawRect( 20, 20, 100, 50 );
g.drawString( "drawRect", 20, 85 );
g.fillRect( 20, 120, 100, 50 );
g.drawString( "fillRect", 20, 185 );
g.setColor( Color.blue ); // drawRoundRect & fillRoundRect in blue.
g.drawRoundRect( 150, 20, 100, 50, 30, 30 );
g.drawString( "drawRoundRect", 150, 85 );
g.fillRoundRect( 150, 120, 100, 50, 30, 30 );
g.drawString( "fillRoundRect", 150, 185 );
g.setColor( Color.gray ); // drawOval & fillOval in gray.
g.drawOval( 280, 20, 100, 50 );
g.drawString( "drawOval", 280, 85 );
g.fillOval( 280, 120, 100, 50 );
g.drawString( "fillOval", 280, 185 );
g.setColor( Color.yellow ); // drawArc & fillArc in yellow.
g.drawArc( 410, 20, 100, 50, 0, -270 );
g.drawString( "drawArc", 410, 85 );
g.fillArc( 410, 120, 100, 50, 0, -270 );
g.drawString( "fillArc", 410, 185 );
}
}
/* * * Tekenen met Java * */ import java.awt.*; import java.applet.*; public class Tekenen extends Applet { public void init() { } public void paint(Graphics g) { g.setColor( Color.red ); // drawRect & fillRect in red. g.drawRect( 20, 20, 100, 50 ); g.drawString( "drawRect", 20, 85 ); g.fillRect( 20, 120, 100, 50 ); g.drawString( "fillRect", 20, 185 ); g.setColor( Color.blue ); // drawRoundRect & fillRoundRect in blue. g.drawRoundRect( 150, 20, 100, 50, 30, 30 ); g.drawString( "drawRoundRect", 150, 85 ); g.fillRoundRect( 150, 120, 100, 50, 30, 30 ); g.drawString( "fillRoundRect", 150, 185 ); g.setColor( Color.gray ); // drawOval & fillOval in gray. g.drawOval( 280, 20, 100, 50 ); g.drawString( "drawOval", 280, 85 ); g.fillOval( 280, 120, 100, 50 ); g.drawString( "fillOval", 280, 185 ); g.setColor( Color.yellow ); // drawArc & fillArc in yellow. g.drawArc( 410, 20, 100, 50, 0, -270 ); g.drawString( "drawArc", 410, 85 ); g.fillArc( 410, 120, 100, 50, 0, -270 ); g.drawString( "fillArc", 410, 185 ); } }
Download code (.txt)
|
|
|
Stemmen |
Niet ingelogd. |
|