Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import basis.*;
- public class Lampe
- {
- /*Attribute */
- private int xPosition;
- private int yPosition;
- private Color farbe;
- private boolean an;
- private boolean istAn;
- private int groesse;
- private Stift stift;
- public Lampe(){
- stift = new Stift();
- farbe = Farbe.rgb(255,0,0);
- xPosition = 100;
- yPosition = 100;
- groesse = 10;
- an = false;
- }
- public void setzeFarbe(Color pFarbe) {
- this.farbe = pFarbe; //Setzt Farbe
- }
- public void setzeAn(boolean pAn) {
- this.an = pAn; //Schaltet die Lampe an oder aus
- }
- public void istAn(boolean pistAn) {
- this.istAn = pistAn;
- }
- public void setzeGroesse(int pGroesse) {
- this.groesse = pGroesse; //Setzt die Größe
- }
- public int gibGroesse(){
- return this.groesse;
- }
- public void setzeXPosition(int pXPosition) {
- this.xPosition = pXPosition;
- }
- public int gibXPosition() {
- return this.xPosition;
- }
- public void setzeYPosition(int pYPosition) {
- this.yPosition = pYPosition;
- }
- public int gibYPosition(){
- return this.yPosition;
- }
- public void loescheLampe(){
- stift.setzeFuellMuster(Muster.GEFUELLT);
- stift.radiere();
- stift.kreis(xPosition,yPosition,groesse);
- stift.normal();
- }
- public void zeigeLampe() {
- stift.normal();
- if (an) {
- stift.setzeFuellMuster(Muster.GEFUELLT);
- stift.setzeFarbe(farbe);
- stift.kreis(xPosition,yPosition,groesse);
- }
- if (istAn){
- stift.setzeFuellMuster(Muster.DURCHSICHTIG);
- stift.kreis(xPosition,yPosition,groesse);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement