GK Informatik 
     
     | 
    Arbeitsblatt JAVA
    12b: 
     
    Zeichenmethoden  | 
    JSt. 12/1  | 
  
  
    | NAME:  | 
  
 
Die Methoden werden benutzt, indem das Graphics-Objekt und die benötigte
Methode angeben werden, also z.B.:
g.drawLine(1,1,100,100);
  - drawLine(int x1, int y1, int x2, int y2)
    Eine Strecke wird vom Punkt P1(x1|y1) zum Punkt P2(x2|y2) gezeichnet.
   
  
  - drawRect(int x, int y, int width, int height)
     Ein leeres Rechteck, das beim Punkt P(x|y) anfängt und width Punkte nach rechts und
    height Punkte nach unten reicht, wird gezeichnet.
  
  
  - fillRect(int x, int y, int width, int height)
     Ein gefülltes Rechteck, das beim Punkt P(x|y) anfängt und width Punkte nach rechts
    und height Punkte nach unten reicht, wird gezeichnet.
  
  
  - drawOval(int x, int y, int width, int height)
     Eine Ellipse wird gezeichnet, die das (nicht dargestellte) Rechteck, das beim Punkt
    P(x|y) anfängt und width Punkte nach rechts und height Punkte nach unten reicht, innen
    berührt.
  
  
  - fillOval(int x, int y, int width, int height)
     Eine gefüllte Ellipse wird gezeichnet, die das (nicht dargestellte) Rechteck, das
    beim Punkt P(x|y) anfängt und width Punkte nach rechts und height Punkte nach unten
    reicht, innen berührt.
  
  
  - drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
     Zeichnet ein Ellipsenstück innerhalb eines Rechtecks, das beim Punkt P(x|y) anfängt
    und width Punkte nach rechts und height Punkte nach unten reicht. Dabei fängt der Bogen
    bei startAngel an und wird von dort soweit gezeichnet, wie arcAngle vorgibt. 0° ist dabei
    bei 3 Uhr, also rechts. Positive Winkelwerte werden entgegen dem Uhrzeigersinn gezeichnet.
  
  
  - fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
     Zeichnet ein ausgefülltes Ellipsenstück innerhalb eines Rechtecks, das beim Punkt
    P(x|y) anfängt und width Punkte nach rechts und height Punkte nach unten reicht. Dabei
    fängt der Bogen bei startAngel an und wird von dort soweit gezeichnet, wie arcAngle
    vorgibt. 0° ist dabei bei 3 Uhr, also rechts. Positive Winkelwerte werden entgegen dem
    Uhrzeigersinn gezeichnet.
  
  
  - drawString(String str, int x, int y)
 
    Gibt des String str beim Punkt P(x|y) aus.
  
  
  - translate(int x, int y)
     Setzt den Koordinatenursprung auf den Punkt P(x|y). Dieser wird dann (0|0).
© Ralph-Erich Hildebrandt, Neuss / April 1999