package com.gmail.lichtenrider98.LichtenLP.Foerster.Akten.Tool;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
public class Main {
static JFrame Main = new JFrame("Förster Akten Tool");
//Text Felder
static JTextField Foerster=new JTextField("Deinen Name eintragen");
static JTextField F1T=new JTextField("Täter");
static JTextField F3T1=new JTextField("Logs");
static JTextField F3T2=new JTextField("Mushroom");
static JTextField F4T=new JTextField("Logs");
//Variablen
static String FoersterName;
static String Taeter;
static float LogsB;
static float Logs;
static float Mush;
static int Geld=0;
//static int Jail=0;
//StartFenster und Fenster 1
public static void main(String[] args){
//1.Fenster:
Main.setVisible(true);
Main.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Main.setSize(300,200);
//Eingabe des Förster namens:
Foerster.setEditable(true);
JButton MainB= new JButton("Bestättigen");
ActionListener MainA = new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
FoersterName = Foerster.getText();
System.out.println(FoersterName);
Main.setVisible(false);
JFrame F1=new JFrame("Täter Name eingeben");
F1.setVisible(true);
F1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
F1.setSize(300,200);
F1T.setEditable(true);
JButton F1B = new JButton("Täter Bestättigen");
ActionListener F1A = new ActionListener(){
public void actionPerformed(ActionEvent e) {
F2();
}
};
F1B.addActionListener(F1A);
F1T.addActionListener(F1A);
JPanel F1P=new JPanel();
F1P.add(F1B);
F1.add(F1T);
F1.add(F1P);
F1.setLayout(new GridLayout(2,1));
}
};
MainB.addActionListener(MainA);
Foerster.addActionListener(MainA);
JPanel MainP=new JPanel();
MainP.add(MainB);
Main.add(Foerster);
Main.add(MainP);
Main.setLayout(new GridLayout(2,1));
}
//Fenster 2
private static void F2(){
Taeter = F1T.getText();
System.out.println(Taeter);
JFrame F2=new JFrame("Tat wählen");
F2.setVisible(true);
F2.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
F2.setSize(300,200);
JButton F2B1 = new JButton("Freebuild+NewHeaven");
ActionListener F2A1 = new ActionListener(){
public void actionPerformed(ActionEvent e) {
F3();
}
};
F2B1.addActionListener(F2A1);
JButton F2B2 = new JButton("Baumfarm");
ActionListener F2A2 = new ActionListener(){
public void actionPerformed(ActionEvent e) {
F4();
}
};
F2B2.addActionListener(F2A2);
JPanel F2P=new JPanel();
F2P.add(F2B1);
F2P.add(F2B2);
F2.add(F2P);
}
private static void F3(){
System.out.println("Freebuild");
JFrame F3=new JFrame("Logs Zahlen eingeben, wen nix 0");
F3.setVisible(true);
F3.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
F3.setSize(400,200);
F3T1.setEditable(true);
F3T2.setEditable(true);
Logs=0;
LogsB=0;
Mush=0;
JButton F3B = new JButton("Straffe berechnen");
ActionListener F3A = new ActionListener(){
public void actionPerformed(ActionEvent e) {
String LogsS=F3T1.getText();
Logs = Float.valueOf(LogsS);
String MushS=F3T2.getText();
Mush = Float.valueOf(MushS);
F5();
}
};
F3B.addActionListener(F3A);
JPanel F3P=new JPanel();
F3P.add(F3B);
F3.add(F3T1);
F3.add(F3T2);
F3.add(F3P);
F3.setLayout(new GridLayout(3,1));
}
private static void F4(){
System.out.println("Baumfarm");
JFrame F4=new JFrame("Logs Zahlen eingeben, wen nix 0");
F4.setVisible(true);
F4.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
F4.setSize(400,200);
F4T.setEditable(true);
JButton F4B = new JButton("Straffe berechnen");
Logs=0;
LogsB=0;
Mush=0;
ActionListener F4A = new ActionListener(){
public void actionPerformed(ActionEvent e) {
String LogsBS=F4T.getText();
LogsB = Float.valueOf(LogsBS);
F5();
}
};
F4B.addActionListener(F4A);
JPanel F4P=new JPanel();
F4P.add(F4B);
F4.add(F4T);
F4.add(F4P);
F4.setLayout(new GridLayout(2,1));
}
private static void F5(){
System.out.println(LogsB);
System.out.println(Logs);
System.out.println(Mush);
float Jail=0;
int Geld=0;
if(Logs<4){
}
else{
if(Logs>4){
int Preis=150;
if(Logs<10){
Geld = (int) (Logs*Preis);
}
if(Logs>9){
int Geld1 = (int) (Logs*Preis);
Jail= (float) (Geld1/200);
Geld=(int) (Logs*Preis);
}
}
}
if(LogsB<4){
}
else{
if(LogsB>4){
int Preis=250;
if(Logs<10){
Geld = (int) (LogsB*Preis);
}
if(LogsB>9){
int Geld1 = (int) (LogsB*Preis);
Jail= (float) (Geld1/200+Jail);
Geld=(int) (Logs*Preis)+Geld;
}
}
}
if(Mush<4){
}
else{
if(Mush>4){
int Preis=100;
if(Mush<20){
Geld = (int) (Mush*Preis);
}
if(Mush>19){
int Geld2 = (int) (LogsB*Preis);
Jail= (float) (Geld2/200+Jail);
Geld=(int) (Logs*Preis)+Geld;
}
}
}
System.out.println(Geld);
System.out.println(Jail);
if(Geld==0){
JFrame Nix=new JFrame("Es gibt keine Akte...");
Nix.setVisible(true);
Nix.setSize(300,200);
Nix.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JTextField NixT= new JTextField("Es gibt keine Akte!");
NixT.setEditable(false);
Nix.add(NixT);
}
else{
//Freebuild
if(LogsB<4){
//ohne Pilz
if(Mush<4){
//ohne Jail
if(Jail==0){
JFrame Akte=new JFrame("Die feritge Akte:");
Akte.setVisible(true);
Akte.setSize(300,200);
Akte.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JTextArea AkteT= new JTextArea();
AkteT.append("Täter: "+Taeter+
"\n"+"Förster(in): "+FoersterName+
"\n"+"Logs: "+Logs+
"\n"+"Strafe: "+Geld+"m + Verwarnung");
AkteT.setEditable(false);
Akte.add(AkteT);
}
//mit Jail
else{
JFrame Akte=new JFrame("Die feritge Akte:");
Akte.setVisible(true);
Akte.setSize(300,200);
Akte.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JTextArea AkteT= new JTextArea();
AkteT.append("Täter: "+Taeter+
"\n"+"Förster(in): "+FoersterName+
"\n"+"Logs: "+Logs+
"\n"+"Strafe: "+Geld+"m + "+Jail+"min Jail");
AkteT.setEditable(false);
Akte.add(AkteT);
}
}
//mit Pilz
else{
//ohne Jail
if(Jail==0){
JFrame Akte=new JFrame("Die feritge Akte:");
Akte.setVisible(true);
Akte.setSize(300,200);
Akte.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JTextArea AkteT= new JTextArea();
AkteT.append("Täter: "+Taeter+
"\n"+"Förster(in): "+FoersterName+
"\n"+"Logs: "+Logs+" Mushroom: "+Mush+
"\n"+"Strafe: "+Geld+"m + Verwarnung");
AkteT.setEditable(false);
Akte.add(AkteT);
}
//mit Jail
else{
JFrame Akte=new JFrame("Die feritge Akte:");
Akte.setVisible(true);
Akte.setSize(300,200);
Akte.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JTextArea AkteT= new JTextArea();
AkteT.append("Täter: "+Taeter+
"\n"+"Förster(in): "+FoersterName+
"\n"+"Logs: "+Logs+" Mushroom: "+Mush+
"\n"+"Strafe: "+Geld+"m + "+Jail+"min Jail");
AkteT.setEditable(false);
Akte.add(AkteT);
}
}
}
//Baumfarm
else{
//ohne Jail
if(Jail==0){
JFrame Akte=new JFrame("Die feritge Akte:");
Akte.setVisible(true);
Akte.setSize(300,200);
Akte.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JTextArea AkteT= new JTextArea();
AkteT.append("Täter: "+Taeter+
"\n"+"Förster(in): "+FoersterName+
"\n"+"Ort: Baumfarm"+
"\n"+"Logs: "+LogsB+
"\n"+"Strafe: "+Geld+"m + Verwarnung");
AkteT.setEditable(false);
Akte.add(AkteT);
}
//mit Jail
else{
JFrame Akte=new JFrame("Die feritge Akte:");
Akte.setVisible(true);
Akte.setSize(300,200);
Akte.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JTextArea AkteT= new JTextArea();
AkteT.append("Täter: "+Taeter+
"\n"+"Förster(in): "+FoersterName+
"\n"+"Ort: Baumfarm"+
"\n"+"Logs: "+LogsB+
"\n"+"Strafe: "+Geld+"m + "+Jail+"min Jail");
AkteT.setEditable(false);
Akte.add(AkteT);
}
}
}
}
}
Alles anzeigen