Pastebin
81825 geplaatste codes! 

Deprecated: Assigning the return value of new by reference is deprecated in /home/joel/domains/plaatscode.be/public_html/toon.php on line 13

Plaats #33078 (Java)

Gepost op 19-10-2008 13:50 door keffie91
Downloaden als .txt-bestand - Bewerk en post opnieuw
  1. import java.awt.*;
  2. import java.io.*;
  3. public class Rectangle implements Serializable {
  4.         public Point p1, p2;/* new Points, the points where you pressed and
  5.          released the mouse*/
  6.        
  7.         public Rectangle(){
  8.                 p1 = new Point();
  9.                 p2 = new Point();
  10.         }
  11.         public Rectangle(Point a, Point b){
  12.                 p1 = new Point(a);
  13.                 p2 = new Point(b);
  14.         }
  15.         public void draw(Graphics g){
  16.             //draw the rectangle
  17.             g.drawRect(p1.x,p1.y,p2.x-p1.x,p2.y-p1.y);
  18.         }
  19. }
  20.  
© 2014 Sitemasters.be - Gehost door Vircon