@@ -39,6 +39,7 @@ public class Gaertner | |||
this.flbeet = flbeet; | |||
this.fenster = fenster; | |||
this.flweg = flweg; | |||
this.flpfl = flpfl; | |||
pflanzen = new ArrayList<>(); | |||
@@ -77,24 +78,21 @@ public class Gaertner | |||
flbeet.setBeet(randomwertex,randomwertey); | |||
flweg.setWeg(randomwertex,randomwertey); | |||
pfl = new Pflanze1(100,100,3); | |||
pfl2 = new Pflanze1(200,400,4); | |||
meinGarten.hinzufuegenPflanze(pfl); | |||
meinGarten.hinzufuegenPflanze(pfl2); | |||
for (int i = 0; i<5; i++) | |||
{ | |||
pfl = new Pflanze1(100+(i*50),100+(i*50),3); | |||
meinGarten.hinzufuegenPflanze(pfl); | |||
} | |||
meinGarten.zeichnePflanzen(); | |||
//pfl = new Pflanze1(100,100,3); | |||
//pfl2 = new Pflanze1(200,400,4); | |||
meinGarten.zeichnePflanzen(); | |||
} | |||
/* | |||
/* | |||
public Pflanze getPflanze(int x,int y) | |||
{ | |||
return meinGarten.naechstePflanze(x,y); | |||
} | |||
public void zeichnen() | |||
{ | |||
//meinGarten.zeichnen(); | |||
pfl.draw(); | |||
System.out.println("??"); | |||
} | |||
*/ | |||
}*/ | |||
} |
@@ -5,12 +5,7 @@ | |||
*/ | |||
package garten.view; | |||
import java.awt.BasicStroke; | |||
import java.awt.Container; | |||
import java.awt.geom.Line2D; | |||
import javax.swing.JButton; | |||
import javax.swing.JFrame; | |||
import javax.swing.OverlayLayout; | |||
/** | |||
* | |||
@@ -18,21 +13,9 @@ import javax.swing.OverlayLayout; | |||
*/ | |||
public class Fenster extends JFrame | |||
{ | |||
private Line2D.Float Gerade; | |||
private BasicStroke pinsel; | |||
private static final float DICKE = 2f; | |||
private JButton btnnl; | |||
private JButton btnnr; | |||
public Fenster() | |||
{ | |||
pinsel = new BasicStroke(DICKE); | |||
Gerade = new Line2D.Float(); | |||
btnnl = new JButton(" > "); | |||
btnnr = new JButton(" < "); | |||
Container hauptkiste = this.getContentPane(); | |||
hauptkiste.setLayout(new OverlayLayout(hauptkiste)); | |||
/* | |||
JPopupMenu popup = new JPopupMenu(); | |||
@@ -45,7 +28,8 @@ public class Fenster extends JFrame | |||
hauptkiste.add(popup); | |||
JPopupMenu.setDefaultLightWeightPopupEnabled(false); | |||
popup.setVisible(true); | |||
*/ | |||
*/ | |||
this.setTitle("Garten von Paul und Jan"); | |||
this.pack(); | |||
this.setDefaultCloseOperation(EXIT_ON_CLOSE); | |||
@@ -55,17 +39,6 @@ public class Fenster extends JFrame | |||
public void paintComponent() | |||
{ | |||
/* | |||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, | |||
RenderingHints.VALUE_ANTIALIAS_ON); | |||
Gerade.setLine(200, 200, 400, 400); | |||
g2.setStroke(pinsel); | |||
g2.setPaint(Color.BLACK); | |||
//g2.draw(Kreis); | |||
g2.draw(Gerade); | |||
this.repaint(); | |||
*/ | |||
} | |||
} |
@@ -40,7 +40,7 @@ public class FlaecheBeet extends JPanel | |||
} | |||
} | |||
} | |||
public void setBeet(int[] x, int[] y) | |||
public void setBeet(int[] x, int[] y) //set = automatisch zeichnen | |||
{ | |||
randomwertex = x; | |||
randomwertey = y; |
@@ -52,7 +52,7 @@ public class FlaechePflanzen extends JPanel | |||
} | |||
} | |||
} | |||
public void setPflanzen(ArrayList<Pflanze> temppflanzen) | |||
public void setPflanzen(ArrayList<Pflanze> temppflanzen) //set = automatisch zeichnen | |||
{ | |||
pflanzen.addAll(0, temppflanzen); | |||
repaint(); |
@@ -44,8 +44,8 @@ public class FlaecheWeg extends JPanel | |||
} | |||
} | |||
public void setWeg(int[] x, int[] y) | |||
{ | |||
public void setWeg(int[] x, int[] y)//set = automatisch zeichnen | |||
{ | |||
randomwertex = x; | |||
randomwertey = y; | |||
repaint(); |