@@ -6,9 +6,8 @@ | |||
package garten.model; | |||
import garten.view.Fenster; | |||
import garten.view.FlaecheBeet; | |||
import garten.view.FlaechePflanzen; | |||
import garten.view.FlaecheWeg; | |||
import garten.view.GUI; | |||
import java.awt.MouseInfo; | |||
import java.awt.event.ActionEvent; | |||
import java.awt.event.ActionListener; | |||
import java.awt.event.MouseEvent; | |||
@@ -22,33 +21,37 @@ import javax.swing.SwingUtilities; | |||
* | |||
* @author Jan | |||
*/ | |||
public class Gaertner implements MouseMotionListener, MouseListener, | |||
ActionListener | |||
public class Gaertner implements MouseMotionListener, MouseListener,ActionListener | |||
{ | |||
private Garten meinGarten; | |||
private Fenster fenster; | |||
private boolean pflanzebewegt; | |||
private boolean gartenexistiert; | |||
private boolean bepflanzungexistiert; | |||
private Beet bepflanzeBeet; | |||
MouseEvent koordinbeet; //x,y Koordinaten reichen eigentlich | |||
private int[] aktuellesBeet; | |||
Pflanze1 pfl1; | |||
Pflanze2 pfl2; | |||
Pflanze3 pfl3; | |||
int height; | |||
int width; | |||
GUI gui; | |||
public Gaertner(Fenster fenster, FlaecheBeet flbeet, FlaecheWeg flweg, | |||
FlaechePflanzen flpfl) | |||
public Gaertner(Fenster fenster) | |||
{ | |||
meinGarten = new Garten(flbeet, flweg, flpfl); | |||
this.fenster = fenster; //Zur späteren Steuerung Pop up usw. | |||
this.fenster = fenster; | |||
meinGarten = new Garten(fenster.getFlbeet(), fenster.getFlweg(), fenster.getFlpfl()); | |||
//this.gui = gui; | |||
//meinGarten = new Garten(gui.getFlaecheBeet2(), gui.getFlaecheWeg1(), gui.getFlaechePflanzen1()); | |||
pflanzebewegt = false; | |||
gartenexistiert = false; | |||
bepflanzungexistiert = false; | |||
aktuellesBeet = new int[2]; | |||
} | |||
public void registerEvents() | |||
@@ -56,6 +59,9 @@ public class Gaertner implements MouseMotionListener, MouseListener, | |||
fenster.addMouseListener(this); | |||
fenster.addMouseMotionListener(this); | |||
//fenster.getFlbeet().addMouseListener(this); | |||
//fenster.getFlpfl().addMouseListener(this); | |||
//fenster.getFlweg().addMouseListener(this); | |||
fenster.getMnGartenanlegen().addActionListener(this); | |||
fenster.getMnRandomPflanzenanlegen().addActionListener(this); | |||
@@ -67,14 +73,53 @@ public class Gaertner implements MouseMotionListener, MouseListener, | |||
fenster.getBtnbepfl2().addActionListener(this); | |||
fenster.getBtnbepfl3().addActionListener(this); | |||
fenster.getRadiobtn1pfl1().addActionListener(this); | |||
fenster.getRadiobtn1pfl2().addActionListener(this); | |||
fenster.getRadiobtn1pfl3().addActionListener(this); | |||
fenster.getRadiobtn2pfl1().addActionListener(this); | |||
fenster.getRadiobtn2pfl2().addActionListener(this); | |||
fenster.getRadiobtn2pfl3().addActionListener(this); | |||
fenster.getRadiobtn3pfl1().addActionListener(this); | |||
fenster.getRadiobtn3pfl2().addActionListener(this); | |||
fenster.getRadiobtn3pfl3().addActionListener(this); | |||
fenster.getRadiobtn4pfl3().addActionListener(this); | |||
fenster.getRadiobtn1pfl1().setVisible(true); | |||
/* | |||
gui.addMouseListener(this); | |||
gui.addMouseMotionListener(this); | |||
gui.getMnGartenanlegen().addActionListener(this); | |||
gui.getMnRandomPflanzenanlegen().addActionListener(this); | |||
gui.getBtnbepfl1().addActionListener(this); | |||
gui.getBtnbepfl2().addActionListener(this); | |||
gui.getBtnbepfl3().addActionListener(this); | |||
gui.getRadiobtn1pfl1().addActionListener(this); | |||
gui.getRadiobtn1pfl2().addActionListener(this); | |||
gui.getRadiobtn1pfl3().addActionListener(this); | |||
gui.getRadiobtn2pfl1().addActionListener(this); | |||
gui.getRadiobtn2pfl2().addActionListener(this); | |||
gui.getRadiobtn2pfl3().addActionListener(this); | |||
gui.getRadiobtn3pfl1().addActionListener(this); | |||
gui.getRadiobtn3pfl2().addActionListener(this); | |||
gui.getRadiobtn3pfl3().addActionListener(this); | |||
gui.getRadiobtn4pfl3().addActionListener(this); | |||
*/ | |||
} | |||
@Override | |||
public void mouseClicked(MouseEvent e) | |||
{ | |||
System.out.println("MouseEvent"); | |||
if (SwingUtilities.isRightMouseButton(e))//Bei Rechtsklick Popup Menü | |||
{ | |||
koordinbeet =e; //abspeichern wegen koordinaten zur weiterverarbeitung | |||
//Zwischenspeichern der Koordinaten der Maus um Beet zu finden | |||
aktuellesBeet[0] = MouseInfo.getPointerInfo().getLocation().x; | |||
System.out.println("Beet x: " + aktuellesBeet[0]); | |||
aktuellesBeet[1] = MouseInfo.getPointerInfo().getLocation().y; | |||
System.out.println("Beet y: " + aktuellesBeet[1]); | |||
fenster.showPoPup(e); | |||
} | |||
else | |||
@@ -115,7 +160,8 @@ public class Gaertner implements MouseMotionListener, MouseListener, | |||
public void actionPerformed(ActionEvent e) | |||
{ | |||
Object key = e.getSource(); | |||
if (key.equals(fenster.getMnGartenanlegen())) //Garten anlegen | |||
//Garten anlegen | |||
if (key.equals(fenster.getMnGartenanlegen())) | |||
{ | |||
if (gartenexistiert == false) | |||
{ | |||
@@ -133,7 +179,8 @@ public class Gaertner implements MouseMotionListener, MouseListener, | |||
} | |||
} | |||
} | |||
else if (key.equals(fenster.getMnRandomPflanzenanlegen())) //Garten Random Bepflanzen | |||
//Garten Random Bepflanzen | |||
else if (key.equals(fenster.getMnRandomPflanzenanlegen())) | |||
{ | |||
if (gartenexistiert == true && bepflanzungexistiert == false) //falls garten existiert bepflanzen | |||
{ | |||
@@ -161,9 +208,60 @@ public class Gaertner implements MouseMotionListener, MouseListener, | |||
JOptionPane.showConfirmDialog(fenster, "Erst muss ein Garten angelegt werden", "Info", JOptionPane.DEFAULT_OPTION); | |||
} | |||
} | |||
else if (key.equals(fenster.getBtnbepfl1()) || key.equals(fenster.getBtnbepfl2()) ||key.equals(fenster.getBtnbepfl3())) | |||
//Ein einzelnes Beet bepflanzen | |||
else if ((key.equals(fenster.getBtnbepfl1()) || key.equals(fenster.getBtnbepfl2()) || key.equals(fenster.getBtnbepfl3())) && gartenexistiert) | |||
{ | |||
int alter = 0; | |||
int pflanzentyp = 0; | |||
int laenge = 0; | |||
//Pflanzentyp festlegen + Länge festlegen | |||
if (key.equals(fenster.getBtnbepfl1())) | |||
{ | |||
pflanzentyp = 1; | |||
laenge = Integer.valueOf(JOptionPane.showInputDialog("Start Länge von 30 - 50")); | |||
} | |||
else if (key.equals(fenster.getBtnbepfl2())) | |||
{ | |||
pflanzentyp = 2; | |||
laenge = Integer.valueOf(JOptionPane.showInputDialog("Start Länge von 10 - 20")); | |||
} | |||
else if (key.equals(fenster.getBtnbepfl3())) | |||
{ | |||
pflanzentyp = 3; | |||
laenge = Integer.valueOf(JOptionPane.showInputDialog("Start Länge von 10 - 20")); | |||
} | |||
//alter bekommen | |||
if (fenster.getRadiobtn1pfl1().isSelected() || fenster.getRadiobtn1pfl2().isSelected() || fenster.getRadiobtn1pfl3().isSelected()) | |||
{ | |||
alter = 1; | |||
} | |||
else if (fenster.getRadiobtn2pfl1().isSelected() || fenster.getRadiobtn2pfl2().isSelected() || fenster.getRadiobtn2pfl3().isSelected()) | |||
{ | |||
alter = 2; | |||
} | |||
else if (fenster.getRadiobtn3pfl1().isSelected() || fenster.getRadiobtn3pfl2().isSelected() || fenster.getRadiobtn3pfl3().isSelected()) | |||
{ | |||
alter = 3; | |||
} | |||
else if (fenster.getRadiobtn4pfl3().isSelected()) | |||
{ | |||
alter = 4; | |||
} | |||
System.out.println("Pflanzentyp : " + pflanzentyp + " Alter: " + alter + " Länge: " + laenge); | |||
PflanzengruppenKonfigurator konfig = new PflanzengruppenKonfigurator(); | |||
konfig.alter(alter); | |||
konfig.pflanzenTyp(pflanzentyp); | |||
konfig.startlaenge(laenge); | |||
konfig.erstellen(); | |||
System.out.println("Das gefundene Beet : " + meinGarten.getBeet(aktuellesBeet)); | |||
System.out.println("Alle beete" + meinGarten.getBeete()); | |||
System.out.println("Pflanze konfiguriert"); | |||
bepflanzungexistiert = true; | |||
} | |||
} | |||
@@ -57,19 +57,25 @@ public class Garten extends Kompositum | |||
{ | |||
flbeet.zeichneBeete(beete); | |||
} | |||
/* | |||
public int getBeet(MouseEvent e) | |||
public Beet getBeet(int[] mausposition) | |||
{ | |||
Beet tempBeet; | |||
System.out.println("Suche richtiges Beet"); | |||
Beet tempBeet = null; | |||
for (Beet b : beete) | |||
{ | |||
tempBeet = b; | |||
} | |||
//return tempBeet; | |||
int[] koordinvergleich = b.getKoordinaten(); | |||
System.out.println("Maus: " +mausposition[0] +" " + mausposition[1]); | |||
System.out.println("Beet: " +koordinvergleich[0]+" " + koordinvergleich[1]+" " + koordinvergleich[2]+" " + koordinvergleich[3]); | |||
if(koordinvergleich[0]<mausposition[0] && koordinvergleich[1]<mausposition[1] && (koordinvergleich[2]+koordinvergleich[0]) >mausposition[0] && (koordinvergleich[3]+koordinvergleich[1]) > mausposition[1] ) | |||
{ | |||
System.err.println("Kommt zum Vergleich?"); | |||
tempBeet = b; | |||
} | |||
} | |||
return tempBeet; | |||
} | |||
//Funktionen Wege | |||
*/ | |||
public void hinzufuegenWeg(int sx, int sy, int ex, int ey) | |||
{ | |||
Weg neuerWeg = new Weg(sx, sy, ex, ey); |
@@ -6,6 +6,8 @@ | |||
package garten.model; | |||
import java.util.ArrayList; | |||
/** | |||
* | |||
* @author Jan | |||
@@ -16,21 +18,44 @@ class Pflanzengruppe | |||
private int pflanzentyp; | |||
private int startlaenge; | |||
private ArrayList<Pflanze> pflanzen; | |||
private Beet beet; | |||
Pflanze1 pfl1; | |||
Pflanze2 pfl2; | |||
Pflanze3 pfl3; | |||
Pflanzengruppe(int pflanzenTyp,int alter, int startlaenge) | |||
Pflanzengruppe(int pflanzenTyp,int alter, int startlaenge, Beet beet) | |||
{ | |||
this.alter = alter; | |||
this.pflanzentyp = pflanzenTyp; | |||
this.startlaenge = startlaenge; | |||
this.beet = beet; | |||
} | |||
public void anzeigen() | |||
{ | |||
} | |||
public void beginnebepflanzung() | |||
public ArrayList<Pflanze> beginnebepflanzung() | |||
{ | |||
beet.getKoordinaten(); | |||
if(pflanzentyp == 1) | |||
{ | |||
pfl1 = new Pflanze1(alter, alter, alter, startlaenge); | |||
pflanzen.add(pfl1); | |||
} | |||
else if (pflanzentyp ==2) | |||
{ | |||
pfl2 = new Pflanze2(alter, alter, alter, startlaenge); | |||
pflanzen.add(pfl1); | |||
} | |||
else if (pflanzentyp ==3) | |||
{ | |||
pfl3 = new Pflanze3(alter, alter, alter, startlaenge); | |||
pflanzen.add(pfl1); | |||
} | |||
return pflanzen; | |||
} | |||
} |
@@ -15,15 +15,16 @@ class PflanzengruppenKonfigurator | |||
private int alter = 1; | |||
private int pflanzenTyp =1; | |||
private int startlaenge =1; | |||
private Beet beet; | |||
public PflanzengruppenKonfigurator() | |||
{ | |||
} | |||
public Pflanzengruppe erstellen() throws IllegalArgumentException | |||
public Pflanzengruppe erstellen() throws IllegalArgumentException | |||
{ | |||
konfigurationPruefen(); | |||
Pflanzengruppe pflgruppe = new Pflanzengruppe(pflanzenTyp,alter,startlaenge); | |||
Pflanzengruppe pflgruppe = new Pflanzengruppe(pflanzenTyp,alter,startlaenge,beet); | |||
return pflgruppe; | |||
} | |||
@@ -44,6 +45,11 @@ class PflanzengruppenKonfigurator | |||
this.startlaenge = startlaenge; | |||
return this; | |||
} | |||
public PflanzengruppenKonfigurator beet(Beet beet) | |||
{ | |||
this.beet = beet; | |||
return this; | |||
} | |||
private void konfigurationPruefen() throws IllegalArgumentException | |||
{ |
@@ -11,9 +11,8 @@ import garten.view.Fenster; | |||
import garten.view.FlaecheBeet; | |||
import garten.view.FlaechePflanzen; | |||
import garten.view.FlaecheWeg; | |||
import java.awt.Color; | |||
import java.awt.Container; | |||
import javax.swing.OverlayLayout; | |||
import javax.swing.JOptionPane; | |||
import javax.swing.UIManager; | |||
/** | |||
* Builder Class | |||
@@ -23,27 +22,26 @@ public class start | |||
{ | |||
public start() | |||
{ | |||
Color hintergrund = new Color(34, 139, 34); | |||
FlaecheBeet flbeet = new FlaecheBeet(); | |||
FlaecheWeg flweg = new FlaecheWeg(); | |||
FlaechePflanzen flpflanzen = new FlaechePflanzen(); | |||
Fenster view = new Fenster(); | |||
flpflanzen.setOpaque(false); | |||
flbeet.setOpaque(false); | |||
flbeet.setComponentPopupMenu(view.getPopup()); | |||
flweg.setOpaque(false); | |||
Container hauptkiste = view.getContentPane(); | |||
hauptkiste.setLayout(new OverlayLayout(hauptkiste)); | |||
hauptkiste.setBackground(hintergrund); | |||
hauptkiste.add(flpflanzen); | |||
hauptkiste.add(flbeet); | |||
hauptkiste.add(flweg); | |||
Fenster fenster = new Fenster(flbeet,flweg,flpflanzen); | |||
Gaertner ga = new Gaertner(fenster); | |||
Gaertner ga = new Gaertner(view,flbeet,flweg,flpflanzen); | |||
ga.registerEvents(); | |||
//GUI gui = new GUI(); | |||
//Gaertner ga = new Gaertner(gui); | |||
//ga.registerEvents(); | |||
//gui.setBackground(Color.yellow); | |||
//gui.setSize(1000, 1000); | |||
//ga.registerEvents(); | |||
//gui.setVisible(true); | |||
} | |||
/** | |||
@@ -51,6 +49,19 @@ public class start | |||
*/ | |||
public static void main(String[] args) | |||
{ | |||
try | |||
{ | |||
for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { | |||
if ("Nimbus".equals(info.getName())) { | |||
UIManager.setLookAndFeel(info.getClassName()); | |||
} | |||
} | |||
} | |||
catch(Exception ex) | |||
{ | |||
JOptionPane.showMessageDialog(null, "Fehler!!!"); | |||
} | |||
new start(); | |||
} | |||
} |
@@ -5,7 +5,10 @@ | |||
*/ | |||
package garten.view; | |||
import java.awt.Color; | |||
import java.awt.Container; | |||
import java.awt.MouseInfo; | |||
import java.awt.event.MouseAdapter; | |||
import java.awt.event.MouseEvent; | |||
import javax.swing.ButtonGroup; | |||
import javax.swing.JButton; | |||
@@ -14,6 +17,7 @@ import javax.swing.JMenu; | |||
import javax.swing.JMenuItem; | |||
import javax.swing.JPopupMenu; | |||
import javax.swing.JRadioButton; | |||
import javax.swing.OverlayLayout; | |||
/** | |||
* | |||
@@ -21,94 +25,105 @@ import javax.swing.JRadioButton; | |||
*/ | |||
public class Fenster extends JFrame | |||
{ | |||
JPopupMenu popup; | |||
JMenu mnbepflanzen1; | |||
JMenu mnbepflanzen2; | |||
JMenu mnbepflanzen3; | |||
JMenuItem mnGartenanlegen; | |||
JMenuItem mnRandomPflanzenanlegen; | |||
JButton btnbepfl1; | |||
JButton btnbepfl2; | |||
JButton btnbepfl3; | |||
JRadioButton radiobtn1pfl1; | |||
JRadioButton radiobtn2pfl1; | |||
JRadioButton radiobtn3pfl1; | |||
JRadioButton radiobtn4pfl1; | |||
JRadioButton radiobtn1pfl2; | |||
JRadioButton radiobtn2pfl2; | |||
JRadioButton radiobtn3pfl2; | |||
JRadioButton radiobtn4pfl2; | |||
JRadioButton radiobtn1pfl3; | |||
JRadioButton radiobtn2pfl3; | |||
JRadioButton radiobtn3pfl3; | |||
JRadioButton radiobtn4pfl3; | |||
public Fenster() | |||
final public JPopupMenu popup; | |||
public JMenu mnbepflanzen1; | |||
public JMenu mnbepflanzen2; | |||
public JMenu mnbepflanzen3; | |||
public JMenuItem mnGartenanlegen; | |||
public JMenuItem mnRandomPflanzenanlegen; | |||
public JButton btnbepfl1; | |||
public JButton btnbepfl2; | |||
public JButton btnbepfl3; | |||
private JRadioButton radiobtn1pfl1; | |||
private JRadioButton radiobtn2pfl1; | |||
private JRadioButton radiobtn3pfl1; | |||
private JRadioButton radiobtn1pfl2; | |||
private JRadioButton radiobtn2pfl2; | |||
private JRadioButton radiobtn3pfl2; | |||
private JRadioButton radiobtn1pfl3; | |||
private JRadioButton radiobtn2pfl3; | |||
private JRadioButton radiobtn3pfl3; | |||
private JRadioButton radiobtn4pfl3; | |||
private FlaecheBeet flbeet; | |||
private FlaecheWeg flweg; | |||
private FlaechePflanzen flpfl; | |||
Color hintergrund; | |||
public Fenster(FlaecheBeet flbeet, FlaecheWeg flweg, FlaechePflanzen flpfl) | |||
{ | |||
//PoPupMenü | |||
popup = new JPopupMenu(); | |||
hintergrund = new Color(34, 139, 34); | |||
this.flbeet = flbeet; | |||
this.flweg = flweg; | |||
this.flpfl = flpfl; | |||
flbeet.setOpaque(false); | |||
flweg.setOpaque(false); | |||
flpfl.setOpaque(false); | |||
Container c = this.getContentPane(); | |||
c.setLayout(new OverlayLayout(c)); | |||
c.add(flpfl); | |||
c.add(flbeet); | |||
c.add(flweg); | |||
c.setBackground(hintergrund); | |||
popup = new JPopupMenu(); | |||
mnGartenanlegen = new JMenuItem("Garten anlegen"); | |||
mnRandomPflanzenanlegen = new JMenuItem("Random Bepflanzung"); | |||
popup.add(mnGartenanlegen); | |||
popup.addSeparator(); | |||
popup.add(mnRandomPflanzenanlegen); | |||
popup.addSeparator(); | |||
//PopUpmenü Pflanze 1 | |||
mnbepflanzen1 = new JMenu("Bepflanze mit Pflanze1"); | |||
btnbepfl1 = new JButton("Bepflanzen"); | |||
radiobtn1pfl1 = new JRadioButton("1 Jahr alt"); | |||
radiobtn2pfl1 = new JRadioButton("2 Jahre alt"); | |||
radiobtn3pfl1= new JRadioButton("3 Jahre alt"); | |||
radiobtn4pfl1 = new JRadioButton("4 Jahre alt"); | |||
radiobtn3pfl1 = new JRadioButton("3 Jahre alt"); | |||
//Btn Gruppe Pflanz1 | |||
ButtonGroup radiobtngrp1 = new ButtonGroup(); | |||
radiobtngrp1.add(radiobtn1pfl1); | |||
radiobtngrp1.add(radiobtn2pfl1); | |||
radiobtngrp1.add(radiobtn3pfl1); | |||
radiobtngrp1.add(radiobtn4pfl1); | |||
//Alle Elemente zu PopUpmenü Pflanze 1 hinzufügen | |||
mnbepflanzen1.add(radiobtn1pfl1); | |||
mnbepflanzen1.add(radiobtn2pfl1); | |||
mnbepflanzen1.add(radiobtn3pfl1); | |||
mnbepflanzen1.add(radiobtn4pfl1); | |||
mnbepflanzen1.add(btnbepfl1); | |||
//PopUpmenü Pflanze 2 | |||
mnbepflanzen2 = new JMenu("Bepflanze mit Pflanze2"); | |||
btnbepfl2 = new JButton("Bepflanzen"); | |||
radiobtn1pfl2 = new JRadioButton("1 Jahr alt"); | |||
radiobtn2pfl2 = new JRadioButton("2 Jahre alt"); | |||
radiobtn3pfl2= new JRadioButton("3 Jahre alt"); | |||
radiobtn4pfl2= new JRadioButton("4 Jahre alt"); | |||
radiobtn3pfl2 = new JRadioButton("3 Jahre alt"); | |||
//Btn Gruppe Pflanz2 | |||
radiobtngrp1.add(radiobtn1pfl2); | |||
radiobtngrp1.add(radiobtn2pfl2); | |||
radiobtngrp1.add(radiobtn3pfl2); | |||
radiobtngrp1.add(radiobtn4pfl2); | |||
//Alle Elemente zu PopUpmenü Pflanze 2 hinzufügen | |||
mnbepflanzen2.add(radiobtn1pfl2); | |||
mnbepflanzen2.add(radiobtn2pfl2); | |||
mnbepflanzen2.add(radiobtn3pfl2); | |||
mnbepflanzen2.add(radiobtn4pfl2); | |||
mnbepflanzen2.add(btnbepfl2); | |||
//PopUpmenü Pflanze 3 | |||
mnbepflanzen3 = new JMenu("Bepflanze mit Pflanze3"); | |||
btnbepfl3 = new JButton("Bepflanzen"); | |||
radiobtn1pfl3 = new JRadioButton("1 Jahr alt"); | |||
radiobtn2pfl3 = new JRadioButton("2 Jahre alt"); | |||
radiobtn3pfl3= new JRadioButton("3 Jahre alt"); | |||
radiobtn4pfl3= new JRadioButton("4 Jahre alt"); | |||
radiobtn3pfl3 = new JRadioButton("3 Jahre alt"); | |||
radiobtn4pfl3 = new JRadioButton("4 Jahre alt"); | |||
//Btn Gruppe Pflanz3 | |||
radiobtngrp1.add(radiobtn1pfl3); | |||
radiobtngrp1.add(radiobtn2pfl3); | |||
@@ -120,68 +135,236 @@ public class Fenster extends JFrame | |||
mnbepflanzen3.add(radiobtn3pfl3); | |||
mnbepflanzen3.add(radiobtn4pfl3); | |||
mnbepflanzen3.add(btnbepfl3); | |||
//Alle PopUpmenüs dem PoPup hinzufügen | |||
popup.add(mnbepflanzen1); | |||
popup.addSeparator(); | |||
popup.add(mnbepflanzen2); | |||
popup.addSeparator(); | |||
popup.add(mnbepflanzen3); | |||
popup.setLightWeightPopupEnabled(false); | |||
//flbeet.setComponentPopupMenu(popup); | |||
//popup.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); | |||
this.setTitle("Garten von Paul und Jan"); | |||
this.pack(); | |||
this.setDefaultCloseOperation(EXIT_ON_CLOSE); | |||
this.setSize(900,900); | |||
this.setSize(900, 900); | |||
this.setVisible(true); | |||
this.addMouseListener(new MouseAdapter() | |||
{ | |||
public void mouseClicked(MouseEvent e) | |||
{ | |||
popup.show(flbeet, e.getX(), e.getY()); | |||
} | |||
}); | |||
this.add(popup); | |||
} | |||
public void showPoPup(MouseEvent e) | |||
{ | |||
popup.setLocation(MouseInfo.getPointerInfo().getLocation().x,MouseInfo.getPointerInfo().getLocation().y); | |||
popup.setLocation(MouseInfo.getPointerInfo().getLocation().x, MouseInfo.getPointerInfo().getLocation().y); | |||
popup.setVisible(true); | |||
} | |||
public void hidePopup() | |||
{ | |||
popup.setVisible(false); | |||
} | |||
public JPopupMenu getPopup() | |||
{ | |||
return popup; | |||
} | |||
public JMenuItem getMnGartenanlegen() | |||
/** | |||
* @return the radiobtn1pfl1 | |||
*/ | |||
public JRadioButton getRadiobtn1pfl1() | |||
{ | |||
return mnGartenanlegen; | |||
return radiobtn1pfl1; | |||
} | |||
public JMenuItem getMnRandomPflanzenanlegen() | |||
/** | |||
* @return the radiobtn2pfl1 | |||
*/ | |||
public JRadioButton getRadiobtn2pfl1() | |||
{ | |||
return mnRandomPflanzenanlegen; | |||
return radiobtn2pfl1; | |||
} | |||
/** | |||
* @return the radiobtn3pfl1 | |||
*/ | |||
public JRadioButton getRadiobtn3pfl1() | |||
{ | |||
return radiobtn3pfl1; | |||
} | |||
/** | |||
* @return the radiobtn1pfl2 | |||
*/ | |||
public JRadioButton getRadiobtn1pfl2() | |||
{ | |||
return radiobtn1pfl2; | |||
} | |||
/** | |||
* @return the radiobtn2pfl2 | |||
*/ | |||
public JRadioButton getRadiobtn2pfl2() | |||
{ | |||
return radiobtn2pfl2; | |||
} | |||
/** | |||
* @return the radiobtn3pfl2 | |||
*/ | |||
public JRadioButton getRadiobtn3pfl2() | |||
{ | |||
return radiobtn3pfl2; | |||
} | |||
/** | |||
* @return the radiobtn1pfl3 | |||
*/ | |||
public JRadioButton getRadiobtn1pfl3() | |||
{ | |||
return radiobtn1pfl3; | |||
} | |||
/** | |||
* @return the radiobtn2pfl3 | |||
*/ | |||
public JRadioButton getRadiobtn2pfl3() | |||
{ | |||
return radiobtn2pfl3; | |||
} | |||
/** | |||
* @return the radiobtn3pfl3 | |||
*/ | |||
public JRadioButton getRadiobtn3pfl3() | |||
{ | |||
return radiobtn3pfl3; | |||
} | |||
/** | |||
* @return the radiobtn4pfl3 | |||
*/ | |||
public JRadioButton getRadiobtn4pfl3() | |||
{ | |||
return radiobtn4pfl3; | |||
} | |||
/** | |||
* @return the mnbepflanzen1 | |||
*/ | |||
public JMenu getMnbepflanzen1() | |||
{ | |||
return mnbepflanzen1; | |||
} | |||
/** | |||
* @return the mnbepflanzen2 | |||
*/ | |||
public JMenu getMnbepflanzen2() | |||
{ | |||
return mnbepflanzen2; | |||
} | |||
/** | |||
* @return the mnbepflanzen3 | |||
*/ | |||
public JMenu getMnbepflanzen3() | |||
{ | |||
return mnbepflanzen3; | |||
} | |||
/** | |||
* @return the mnGartenanlegen | |||
*/ | |||
public JMenuItem getMnGartenanlegen() | |||
{ | |||
return mnGartenanlegen; | |||
} | |||
/** | |||
* @return the mnRandomPflanzenanlegen | |||
*/ | |||
public JMenuItem getMnRandomPflanzenanlegen() | |||
{ | |||
return mnRandomPflanzenanlegen; | |||
} | |||
/** | |||
* @return the btnbepfl1 | |||
*/ | |||
public JButton getBtnbepfl1() | |||
{ | |||
return btnbepfl1; | |||
} | |||
public JButton getBtnbepfl2() | |||
/** | |||
* @param btnbepfl1 the btnbepfl1 to set | |||
*/ | |||
public void setBtnbepfl1(JButton btnbepfl1) | |||
{ | |||
return btnbepfl2; | |||
this.btnbepfl1 = btnbepfl1; | |||
} | |||
public JButton getBtnbepfl3() | |||
/** | |||
* @return the btnbepfl2 | |||
*/ | |||
public JButton getBtnbepfl2() | |||
{ | |||
return btnbepfl2; | |||
} | |||
/** | |||
* @return the btnbepfl3 | |||
*/ | |||
public JButton getBtnbepfl3() | |||
{ | |||
return btnbepfl3; | |||
} | |||
/** | |||
* @return the flbeet | |||
*/ | |||
public FlaecheBeet getFlbeet() | |||
{ | |||
return flbeet; | |||
} | |||
/** | |||
* @param flbeet the flbeet to set | |||
*/ | |||
public void setFlbeet(FlaecheBeet flbeet) | |||
{ | |||
this.flbeet = flbeet; | |||
} | |||
/** | |||
* @return the flweg | |||
*/ | |||
public FlaecheWeg getFlweg() | |||
{ | |||
return flweg; | |||
} | |||
/** | |||
* @return the flpfl | |||
*/ | |||
public FlaechePflanzen getFlpfl() | |||
{ | |||
return flpfl; | |||
} | |||
} |