import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
/**
*
* Beschreibung
* Dieses Programm ist zum erstellen der Akten vom JF Team gedacht.
* @version 2.0 vom 27.10.2013
* @Ironlors
*/
public class AktenTool extends JFrame {
// Anfang Attribute
private Button buttonGrief = new Button();
private TextArea textAreaAkte = new TextArea("", 1, 1, TextArea.SCROLLBARS_NONE);
private TextField textFieldName = new TextField();
private Label labelName = new Label();
private Label labelMenge = new Label();
private NumberField numberFieldMenge = new NumberField();
private Label labelTat = new Label();
private Button buttonPflanzen = new Button();
private Label labelAkte = new Label();
private Label labelWarnung = new Label();
private Label labelMin3 = new Label();
// Ende Attribute
public AktenTool(String title) {
// Frame-Initialisierung
super(title);
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
int frameWidth = 504;
int frameHeight = 590;
setSize(frameWidth, frameHeight);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
int x = (d.width - getSize().width) / 2;
int y = (d.height - getSize().height) / 2;
setLocation(x, y);
setResizable(false);
Container cp = getContentPane();
cp.setLayout(null);
// Anfang Komponenten
buttonGrief.setBounds(368, 32, 121, 33);
buttonGrief.setLabel("Grief");
buttonGrief.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
/* d = Strafe
e = Name */
buttonGrief_ActionPerformed(evt);
String e = textFieldName.getText() ;
int c = numberFieldMenge.getInt() ;
int a = c*400;
String f = ("[JF-Akte] "+e+"\n");
String g = (e+" hat "+c+" Blöcke gegrieft\n");
String h = ("Menge: "+c+"\n");
String j = ("[Strafe offen]");
textAreaAkte.setVisible(true);
if (c>=2 && c<=10) {
String d =("Strafe: 30 min Jail\ns");
textAreaAkte.setText(f+g+h+d+j);
} // end of if
if (c >=11 && c<=20) {
String d =("Strafe: 60 min Jail + "+c+"*400 ("+a+" Mark)\n");
textAreaAkte.setText(f+g+h+d+j);
} // end of if
if (c >=21 && c<=30) {
String d =("Strafe: 120 min Jail + "+c+"*400 ("+a+" Mark)\n");
textAreaAkte.setText(f+g+h+d+j);
} // end of if
if (c >=31 && c<=40) {
String d =("Strafe: 200 min Jail + "+c+"*400 ("+a+" Mark)\n");
textAreaAkte.setText(f+g+h+d+j);
} // end of if
if (c >=41 && c<=50) {
String d =("Strafe: 200 min Jail + "+c+"*400 ("+a+" Mark)\n");
textAreaAkte.setText(f+g+h+d+j);
} // end of if
if (c >=51 && c<=60) {
String d =("Strafe: 1 Tag Bann - 1 Woche Bann\n");
textAreaAkte.setText(f+g+h+d+j);
} // end of if
if (c >=61 && c<=199) {
String d =("Strafe: 1 Woche Bann - 1 Monat Bann\n");
textAreaAkte.setText(f+g+h+d+j);
} // end of if
if (c >=200 && c<=299) {
String d =("Strafe: 1 Monat Bann - Perma Bann\n");
textAreaAkte.setText(f+g+h+d+j);
} // end of if
if (c >=300) {
String d =("Strafe: Perma Bann!\n");
textAreaAkte.setText(f+g+h+d+j);
} // end of if
}
});
cp.add(buttonGrief);
textAreaAkte.setBounds(16, 280, 472, 273);
textAreaAkte.setEditable(false);
cp.add(textAreaAkte);
textFieldName.setBounds(80, 40, 105, 25);
cp.add(textFieldName);
labelName.setBounds(8, 40, 62, 28);
labelName.setText("Name:");
labelName.setVisible(true);
labelName.setAlignment(Label.RIGHT);
cp.add(labelName);
labelMenge.setBounds(8, 80, 67, 25);
labelMenge.setText("Menge:");
labelMenge.setAlignment(Label.RIGHT);
cp.add(labelMenge);
numberFieldMenge.setBounds(80, 80, 105, 25);
numberFieldMenge.setText("");
cp.add(numberFieldMenge);
labelTat.setBounds(240, 48, 123, 41);
labelTat.setText("Tat:");
labelTat.setAlignment(Label.RIGHT);
cp.add(labelTat);
buttonPflanzen.setBounds(368, 72, 121, 33);
buttonPflanzen.setLabel("nicht nachgepflanzt");
buttonPflanzen.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
buttonPflanzen_ActionPerformed(evt);
String e = textFieldName.getText() ;
int c = numberFieldMenge.getInt() ;
int a = c*100;
String f = ("[JF-Akte] "+e+"\n");
String g = (e+"hat "+c+" Pflanzen nicht nachgepflanzt\n");
String h = ("Menge: "+c+"\n");
String i = ("Strafe: "+c+"*100="+a+"\n");
String j = ("[Strafe offen]");
textAreaAkte.setText(f+g+h+i+j);
if (c<3) {
textAreaAkte.setText ("zu wenig Logs");
textAreaAkte.setVisible(false);
labelWarnung.setVisible (true);
labelMin3.setVisible (true);
} // end of if
if (c>=3) {
textAreaAkte.setVisible(true);
labelMin3.setVisible (false);
} // end of if
}
});
cp.add(buttonPflanzen);
labelAkte.setBounds(32, 216, 451, 49);
labelAkte.setText("Akte:");
labelAkte.setAlignment(Label.CENTER);
labelAkte.setFont(new Font("Arial", Font.BOLD, 20));
cp.add(labelAkte);
cp.setBackground(new Color(0xC0C0C0));
labelWarnung.setBounds(128, 312, 283, 201);
labelWarnung.setText("Du hast leider zu wenig Logs.");
labelWarnung.setFont(new Font("Arial", Font.BOLD, 20));
labelWarnung.setVisible(false);
labelWarnung.setForeground(Color.RED);
cp.add(labelWarnung);
labelMin3.setBounds(192, 80, 75, 25);
labelMin3.setText("(min. 3)");
labelMin3.setVisible(false);
labelMin3.setForeground(Color.RED);
cp.add(labelMin3);
setTitle("[JF] Akten Tool 2.0 by Ironlors");
// Ende Komponenten
setVisible(true);
} // end of public AktenTool
// Anfang Methoden
public void buttonGrief_ActionPerformed(ActionEvent evt) {
// TODO hier Quelltext einfügen
} // end of buttonGrief_ActionPerformed
public void buttonPflanzen_ActionPerformed(ActionEvent evt) {
// TODO hier Quelltext einfügen
} // end of buttonPflanzen_ActionPerformed
// Ende Methoden
public static void main(String[] args) {
new AktenTool("AktenTool");
} // end of main
} // end of class AktenTool
Alles anzeigen