import javax.swing.*;
import java.awt.event.*;
import java.util.Random;
public class SimpleWindow extends JFrame {
JLabel one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thirteen,fourteen,fifteen,sixteen,seventeen,eighteen,nineteen,twenty,twentyone;
JButton firstButton,secondButton;
JTextField
firstTextField,second,third,fourth,fifth,sixth,seventh,eighth,ninth,tenth,eleventh,tweleth,thirteenth,fourteenth;
JTextArea firstTextArea;
JCheckBox firstCheckBox;
JComboBox firstComboBox,secondComboBox,thirdComboBox,fourthComboBox;
int d,e,f,g,h,i,j,k,l,m,n;
int b = 25;
int c = 10;
String Damage;
Random rand = new Random();
int a = rand.nextInt(100) + 1;
public SimpleWindow() {
createInterface();
}
void createInterface() {
setLayout(null);
one = new JLabel();
two = new JLabel();
three = new JLabel();
four = new JLabel();
five = new JLabel();
six = new JLabel();
seven = new JLabel();
eight = new JLabel();
nine = new JLabel();
ten = new JLabel();
eleven = new JLabel();
twelve = new JLabel();
thirteen = new JLabel();
fourteen = new JLabel();
fifteen=new JLabel();
sixteen = new JLabel();
seventeen= new JLabel();
eighteen = new JLabel();
nineteen = new JLabel();
twenty = new JLabel();
twentyone = new JLabel();
one.setText("Combat ");
two.setText("Armor");
three.setText("Speed");
four.setText("Hit Points Maximum");
five.setText ("Critical Hit Threshold");
six.setText ("Critical Hit Penalty");
seven.setText("Critical Speed Penalty");
eight.setText("Combat ");
nine.setText("Armor");
ten.setText("Speed");
eleven.setText("Hit Points Maximum");
twelve.setText("Critical Hit Threshold");
thirteen.setText ("Critical Hit Penalty");
fourteen.setText ("Critical Speed Penalty");
fifteen.setText("Unit Type");
sixteen.setText("Unit Type");
seventeen.setText("Species");
eighteen.setText("Species");
nineteen.setText("Combatant 1");
twenty.setText("Combatant 2");
twentyone.setText("Play by Play");
one.setBounds (50,170,80,20);
two.setBounds (50,190,80,20);
three.setBounds (50,210,80,20);
four.setBounds (50,230,80,20);
five.setBounds (50,250,80,20);
six.setBounds (50,270,80,20);
seven.setBounds (50,290,80,20);
eight.setBounds (500,170,80,20);
nine.setBounds (500,190,80,20);
ten.setBounds (500,210,80,20);
eleven.setBounds (500,230,80,20);
twelve.setBounds (500,250,80,20);
thirteen.setBounds (500,270,80,20);
fourteen.setBounds (500,290,80,20);
fifteen.setBounds (50,100,80,20);
sixteen.setBounds (500,100,80,20);
seventeen.setBounds(50,130,80,20);
eighteen.setBounds(500,130,80,20);
nineteen.setBounds(150,65,80,20);
twenty.setBounds(600,65,80,20);
twentyone.setBounds(325,370,82,20);
add(one);
add(two);
add(three);
add(four);
add(five);
add(six);
add(seven);
add(eight);
add(nine);
add(ten);
add(eleven);
add(twelve);
add(thirteen);
add(fourteen);
add(fifteen);
add(sixteen);
add(seventeen);
add(eighteen);
add(nineteen);
add(twenty);
add(twentyone);
firstTextField = new JTextField();
second= new JTextField();
third= new JTextField();
fourth= new JTextField();
fifth= new JTextField();
sixth= new JTextField();
seventh= new JTextField();
eighth= new JTextField();
ninth= new JTextField();
tenth= new JTextField();
eleventh= new JTextField();
tweleth= new JTextField();
thirteenth= new JTextField();
fourteenth= new JTextField();
firstTextField.setBounds(150,170,40,20);
second.setBounds(150,190,40,20);
third.setBounds(150,210,40,20);
fourth.setBounds(150,230,40,20);
fifth.setBounds(150,250,40,20);
sixth.setBounds(150,270,40,20);
seventh.setBounds(150,290,40,20);
eighth.setBounds(600,170,40,20);
ninth.setBounds(600,190,40,20);
tenth.setBounds(600,210,40,20);
eleventh.setBounds(600,230,40,20);
tweleth.setBounds(600,250,40,20);
thirteenth.setBounds(600,270,40,20);
fourteenth.setBounds(600,290,40,20);
add(firstTextField);
add(second);
add(third);
add(fourth);
add(fifth);
add(sixth);
add(seventh);
add(eighth);
add(ninth);
add(tenth);
add(eleventh);
add(tweleth);
add(thirteenth);
add(fourteenth);
firstTextArea = new JTextArea();
firstTextArea.setText("");
firstTextArea.setBounds(10,400,760,150 );
add(firstTextArea);
firstCheckBox= new JCheckBox();
firstCheckBox.setText("Save output to file");
firstCheckBox.setBounds(10,550,140,20);
add (firstCheckBox);
{firstButton = new JButton();
secondButton= new JButton();
firstButton.setText("Go");
firstButton.addActionListener(new ActionListener() {
public void actionPerformed (ActionEvent e) {
if (firstButton.getText().equals("Go")){
firstButton.setText("Go");
firstTextField.setText("25");
second.setText("10");
third.setText("5");
fourth.setText("100");
fifth.setText("50");
sixth.setText("0");
seventh.setText("0");
eighth.setText("25");
ninth.setText("10");
tenth.setText("5");
eleventh.setText("100");
tweleth.setText("50");
thirteenth.setText("0");
fourteenth.setText("0");
if(c < a)
hits;
else no hit;
Damage = b*a/100-
}
else {
firstButton.setText("Go");
}
}
}
);
}
secondButton.setText("Halt");
firstButton.setBounds(650,550,75,20);
secondButton.setBounds(550,550,75,20);
add(firstButton);
add(secondButton);
String [] combatstrings = {"Elf", "Drawve", "Human", "Goblin", "Orc"};
String [] Type = {"Infantry"};
firstComboBox= new JComboBox (combatstrings);
secondComboBox = new JComboBox (combatstrings);
thirdComboBox = new JComboBox(Type);
fourthComboBox = new JComboBox(Type);
firstComboBox.setBounds(150,130,140,20);
secondComboBox.setBounds(600,130,140,20);
thirdComboBox.setBounds (150,100,140,20);
fourthComboBox.setBounds (600,100,140,20);
add(firstComboBox);
add(secondComboBox);
add(thirdComboBox);
add(fourthComboBox);
setSize (800,640);
setTitle("Basic Title" );
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
public static void main(String[] args) {
new SimpleWindow();
}}