Jan 5 years ago
parent
commit
eaf6fb85d0

+ 13
- 15
Garten/src/garten/model/Gaertner.java View File

this.flbeet = flbeet; this.flbeet = flbeet;
this.fenster = fenster; this.fenster = fenster;
this.flweg = flweg; this.flweg = flweg;
this.flpfl = flpfl;
pflanzen = new ArrayList<>(); pflanzen = new ArrayList<>();
flbeet.setBeet(randomwertex,randomwertey); flbeet.setBeet(randomwertex,randomwertey);
flweg.setWeg(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(); meinGarten.zeichnePflanzen();
} }
/*
/*
public Pflanze getPflanze(int x,int y) public Pflanze getPflanze(int x,int y)
{ {
return meinGarten.naechstePflanze(x,y); return meinGarten.naechstePflanze(x,y);
}
public void zeichnen()
{
//meinGarten.zeichnen();
pfl.draw();
System.out.println("??");
}
*/
}*/

} }

+ 4
- 31
Garten/src/garten/view/Fenster.java View File

*/ */
package garten.view; 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.JFrame;
import javax.swing.OverlayLayout;


/** /**
* *
*/ */
public class Fenster extends JFrame 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() 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(); JPopupMenu popup = new JPopupMenu();
hauptkiste.add(popup); hauptkiste.add(popup);
JPopupMenu.setDefaultLightWeightPopupEnabled(false); JPopupMenu.setDefaultLightWeightPopupEnabled(false);
popup.setVisible(true); popup.setVisible(true);
*/
*/
this.setTitle("Garten von Paul und Jan"); this.setTitle("Garten von Paul und Jan");
this.pack(); this.pack();
this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setDefaultCloseOperation(EXIT_ON_CLOSE);


public void paintComponent() 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();
*/
} }
} }

+ 1
- 1
Garten/src/garten/view/FlaecheBeet.java View File

} }
} }
} }
public void setBeet(int[] x, int[] y)
public void setBeet(int[] x, int[] y) //set = automatisch zeichnen
{ {
randomwertex = x; randomwertex = x;
randomwertey = y; randomwertey = y;

+ 1
- 1
Garten/src/garten/view/FlaechePflanzen.java View File

} }
} }
} }
public void setPflanzen(ArrayList<Pflanze> temppflanzen)
public void setPflanzen(ArrayList<Pflanze> temppflanzen) //set = automatisch zeichnen
{ {
pflanzen.addAll(0, temppflanzen); pflanzen.addAll(0, temppflanzen);
repaint(); repaint();

+ 2
- 2
Garten/src/garten/view/FlaecheWeg.java View File

} }
} }


public void setWeg(int[] x, int[] y)
{
public void setWeg(int[] x, int[] y)//set = automatisch zeichnen
{
randomwertex = x; randomwertex = x;
randomwertey = y; randomwertey = y;
repaint(); repaint();

Loading…
Cancel
Save