Advertisement
Morogn93

Untitled

Oct 27th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. package MetodyGeneryczne4;
  2.  
  3. // Jedi2.java:
  4. import java.applet.Applet;
  5. import java.awt.*;
  6.  
  7. public class Pair extends Applet {
  8.     public void paint(Graphics g){
  9.         Rysowanie p1 = new Rysowanie("Sith ma czerwony miecz", 20, 20);
  10.         g.drawString(p1.getToBeDrawn(),p1.getXcoordinate(),p1.getYcoordinate());
  11.        
  12.     }
  13.  
  14. }// koniec public class Jedi2.class extends Applet
  15.  
  16. class Rysowanie {
  17.     /*
  18.      * str the string to be drawn.x the x coordinate.y the y coordinate.
  19.      */
  20.  
  21.     private String toBeDrawn;
  22.     private int xCoordinate;
  23.     private int yCoordinate;
  24.  
  25.     public Rysowanie(String napis, int x, int y) {
  26.         this.toBeDrawn = napis;
  27.         this.xCoordinate = x;
  28.         this.yCoordinate = y;
  29.     }
  30.  
  31.     public String getToBeDrawn() {
  32.         return toBeDrawn;
  33.     }
  34.  
  35.     public void setToBeDrawn(String napis) {
  36.         this.toBeDrawn = napis;
  37.  
  38.     }
  39.  
  40.     public int getXcoordinate() {
  41.         return xCoordinate;
  42.     }
  43.  
  44.     public int getYcoordinate() {
  45.         return yCoordinate;
  46.     }
  47.  
  48.     public void setXcoordinate(int x) {
  49.         this.xCoordinate = x;
  50.  
  51.     }
  52.  
  53.     public void setYcoordinate(int y) {
  54.         this.yCoordinate = y;
  55.  
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement