Advertisement
Guest User

Untitled

a guest
Apr 27th, 2021
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. import java.awt.Color;
  2. import basis.*;
  3. public class Lampe
  4. {
  5. /*Attribute */
  6. private int xPosition;
  7. private int yPosition;
  8. private Color farbe;
  9. private boolean an;
  10. private boolean istAn;
  11. private int groesse;
  12. private Stift stift;
  13. public Lampe(){
  14.  
  15. stift = new Stift();
  16. farbe = Farbe.rgb(255,0,0);
  17. xPosition = 100;
  18. yPosition = 100;
  19. groesse = 10;
  20. an = false;
  21.  
  22. }
  23. public void setzeFarbe(Color pFarbe) {
  24. this.farbe = pFarbe; //Setzt Farbe
  25. }
  26. public void setzeAn(boolean pAn) {
  27. this.an = pAn; //Schaltet die Lampe an oder aus
  28. }
  29. public void istAn(boolean pistAn) {
  30. this.istAn = pistAn;
  31. }
  32.  
  33. public void setzeGroesse(int pGroesse) {
  34. this.groesse = pGroesse; //Setzt die Größe
  35. }
  36. public int gibGroesse(){
  37. return this.groesse;
  38. }
  39. public void setzeXPosition(int pXPosition) {
  40. this.xPosition = pXPosition;
  41. }
  42. public int gibXPosition() {
  43. return this.xPosition;
  44. }
  45. public void setzeYPosition(int pYPosition) {
  46. this.yPosition = pYPosition;
  47. }
  48. public int gibYPosition(){
  49. return this.yPosition;
  50. }
  51. public void loescheLampe(){
  52.  
  53. stift.setzeFuellMuster(Muster.GEFUELLT);
  54. stift.radiere();
  55. stift.kreis(xPosition,yPosition,groesse);
  56.  
  57. stift.normal();
  58.  
  59. }
  60. public void zeigeLampe() {
  61.  
  62. stift.normal();
  63.  
  64. if (an) {
  65. stift.setzeFuellMuster(Muster.GEFUELLT);
  66. stift.setzeFarbe(farbe);
  67. stift.kreis(xPosition,yPosition,groesse);
  68. }
  69. if (istAn){
  70. stift.setzeFuellMuster(Muster.DURCHSICHTIG);
  71.  
  72. stift.kreis(xPosition,yPosition,groesse);
  73. }
  74. }
  75. }
  76.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement