package opar;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionListener;
import java.util.*;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.Color;
import java.awt.Font;
public class T {
private static JTextField textField;
private static JTextField textField_1;
private static JTextField textField_2;
private static JTextField textField_3;
private static JTextField textField_4;
private static JTextField textField_5;
private static JTextField textField_6;
private static JLabel label;
private static JTextField textField_7;
private static JLabel label_1;
private static JLabel label_2;
private static JLabel label_3;
private static JTextField textField_8;
private static JTextField textField_9;
private static JLabel label_4;
private static JTextField textField_10;
private static JTextField textField_11;
private static JFrame frame;
static Random r = new Random();
static JButton button_1;
static JButton button_2;
static JButton button_3;
static JButton btnNewButton_3;
static JButton btnNewButton;
static JButton btnNewButton_1;
static JButton btnNewButton_2;
static JButton button;
static int n=0;
static int rom=r.nextInt(501);
static int rom1=r.nextInt(501);
private static JLabel label_7;
private static JLabel lblNewLabel_1;
private static Login l;
private static String []Skin={"红色","橙色","黄色","绿色","蓝色"};
private static JComboBox comboBox ;
private static String []Number={" 整数","小数"};
private static JTextField textField_12;
private static JButton btnNewButton_4;
void Set_T_T1_T2_T3(boolean y)
{
this.textField_3.setEditable(y);
}
void Set_T3()
{
this.textField_3.setText(null);
}
void Set_Setvial(boolean y)
{
frame.setVisible(y);
}
void Set_T1(String x)
{
textField_1.setText(x);
}
void Set_T4_T5_T6_T7()
{
textField_4.setText(textField.getText());
textField_5.setText(textField_1.getText());
textField_6.setText(textField_2.getText());
if(textField_1.getText().equals("+")==true)
n=Integer.parseInt(textField.getText())+Integer.parseInt(textField_2.getText());
else if(textField_1.getText().equals("-")==true)
n=Integer.parseInt(textField.getText())-Integer.parseInt(textField_2.getText());
else if(textField_1.getText().equals("*")==true)
n=Integer.parseInt(textField.getText())*Integer.parseInt(textField_2.getText());
else if(textField_1.getText().equals("/")==true)
n=Integer.parseInt(textField.getText())/Integer.parseInt(textField_2.getText());
textField_7.setText(String.valueOf(n));
System.out.print("n"+n);
}
void set_T_T1_T2_T3()
{
textField.setText(String.valueOf(rom));
textField_2.setText(String.valueOf(rom1));
textField_3.setText(null);
}
void set_T_T1_T2_T3_(boolean t)
{
textField.setEditable(t);
textField_1.setEditable(t);
this.textField_2.setEditable(t);
textField_3.setEditable(t);
}
void Set_T8_T10_T11()
{
textField_8.setText(String.valueOf(new T_Event().Get_t()));
textField_10.setText(String.valueOf(new T_Event().Get_f()));
textField_11.setText( String.valueOf( new T_Event().Get_t() *100 / (new T_Event().Get_f()+new T_Event().Get_t()))+"%");
}
void Set_rom_rom1(int x1,int x2)
{
rom=r.nextInt(x2-x1)+x1;
rom1=r.nextInt(x2-x1)+x1;
}
void Set_T9(String s)
{
textField_9.setText(s);
}
void Set_Login_l(boolean y)
{
l.Set_frame(y);
}
public JComboBox Get_Com()
{
return comboBox;
}
String Get_T3()
{
return textField_3.getText();
}
int Get_n()
{
return n;
}
int Get_T()
{
return Integer.parseInt(textField.getText());
}
int Get_T2()
{
return Integer.parseInt(textField_2.getText());
}
JButton Get_btnNewButton()
{
return btnNewButton;
}
JButton Get_btnNewButton_1()
{
return btnNewButton_1;
}
JButton Get_btnNewButton_2()
{
return btnNewButton_2;
}
JButton Get_button()
{
return button;
}
public JFrame Get_frame()
{
return this.frame;
}
public JTextField Get_T12()
{
return textField_12;
}
public JButton Get_btnNewButton_4()
{
return btnNewButton_4;
}
public JTextField Get_T9()
{
return textField_9;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
frame=new JFrame("小学生四则运算器");
frame.setTitle("\u5929\u751F\u6211\u6750\u5FC5\u6709\u7528\uFF0C\u52A0\u6CB9\u54E6......");
frame.setIconImage(Toolkit.getDefaultToolkit().getImage(T.class.getResource("/opar/\u6807\u7B7E.jpg")));
frame.getContentPane().setBackground(Color.RED);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Dimension screenSize =Toolkit.getDefaultToolkit().getScreenSize();
frame.setSize(500, 500 );
frame.setLocation((screenSize.width-500 )/2, (screenSize.height-500)/2);
frame.getContentPane().setLayout(null);
textField = new JTextField(String.valueOf(rom));
textField.setEditable(false);
textField.setBounds(96, 152, 66, 21);
frame.getContentPane().add(textField);
textField.setColumns(10);
textField_1 = new JTextField(" +");
textField_1.setEditable(false);
textField_1.setBounds(199, 152, 24, 21);
frame.getContentPane().add(textField_1);
textField_1.setColumns(10);
textField_2 = new JTextField(String.valueOf(rom1));
textField_2.setEditable(false);
textField_2.setBounds(257, 152, 66, 21);
frame.getContentPane().add(textField_2);
textField_2.setColumns(10);
JLabel lblNewLabel = new JLabel("=");
lblNewLabel.setBounds(348, 152, 24, 15);
frame.getContentPane().add(lblNewLabel);
textField_3 = new JTextField();
textField_3.setBounds(379, 152, 66, 21);
frame.getContentPane().add(textField_3);
textField_3.setColumns(10);
textField_3.addKeyListener(new T_Event());
textField_4 = new JTextField(textField.getText());
textField_4.setEditable(false);
textField_4.setBounds(96, 198, 66, 21);
frame.getContentPane().add(textField_4);
textField_4.setColumns(10);
textField_5 = new JTextField(" +");
textField_5.setEditable(false);
textField_5.setBounds(199, 198, 24, 21);
frame.getContentPane().add(textField_5);
textField_5.setColumns(10);
textField_6 = new JTextField(textField_2.getText());
textField_6.setEditable(false);
textField_6.setBounds(257, 198, 66, 21);
frame.getContentPane().add(textField_6);
textField_6.setColumns(10);
label = new JLabel("=");
label.setBounds(348, 198, 24, 15);
frame.getContentPane().add(label);
textField_7 = new JTextField();
textField_7.setEditable(false);
textField_7.setBounds(379, 198, 66, 21);
frame.getContentPane().add(textField_7);
textField_7.setColumns(10);
label_1 = new JLabel("\u6B63\u786E\u7B54\u6848");
label_1.setFont(new Font("宋体", Font.PLAIN, 14));
label_1.setBounds(10, 200, 66, 15);
frame.getContentPane().add(label_1);
label_2 = new JLabel("\u8BF7\u89E3\u7B54");
label_2.setFont(new Font("宋体", Font.PLAIN, 14));
label_2.setBounds(10, 152, 58, 18);
frame.getContentPane().add(label_2);
label_3 = new JLabel("\u6B63\u786E\u6570\u76EE");
label_3.setFont(new Font("宋体", Font.PLAIN, 14));
label_3.setBounds(12, 245, 66, 15);
frame.getContentPane().add(label_3);
textField_8 = new JTextField();
textField_8.setEditable(false);
textField_8.setBounds(96, 243, 66, 21);
frame.getContentPane().add(textField_8);
textField_8.setColumns(10);
label_4 = new JLabel("\u9519\u8BEF\u6570\u76EE");
label_4.setBounds(189, 246, 54, 15);
frame.getContentPane().add(label_4);
textField_10 = new JTextField();
textField_10.setEditable(false);
textField_10.setBounds(257, 243, 66, 21);
frame.getContentPane().add(textField_10);
textField_10.setColumns(10);
JLabel label_5 = new JLabel("\u6B63\u786E\u7387");
label_5.setBounds(334, 246, 54, 15);
frame.getContentPane().add(label_5);
textField_11 = new JTextField();
textField_11.setEditable(false);
textField_11.setBounds(379, 243, 66, 21);
frame.getContentPane().add(textField_11);
textField_11.setColumns(10);
btnNewButton = new JButton("\u7B80\u5355");
btnNewButton.setBounds(81, 85, 108, 23);
frame.getContentPane().add(btnNewButton);
btnNewButton.addActionListener(new T_Event());
btnNewButton_1 = new JButton("\u9002\u4E2D");
btnNewButton_1.setBounds(209, 85, 109, 23);
frame.getContentPane().add(btnNewButton_1);
btnNewButton_1.addActionListener(new T_Event());
btnNewButton_2 = new JButton("\u56F0\u96BE");
btnNewButton_2.setBounds(336, 85, 109, 23);
frame.getContentPane().add(btnNewButton_2);
btnNewButton_2.addActionListener(new T_Event());
button = new JButton("\u9000\u51FA");
button.setBounds(96, 390, 93, 23);
frame.getContentPane().add(button);
button.addActionListener(new T_Event());
button_1 = new JButton("\u52A0\u6CD5");
button_1.setBounds(64, 39, 93, 23);
frame.getContentPane().add(button_1);
button_1.addActionListener(new T_Event());
button_2 = new JButton("\u51CF\u6CD5");
button_2.setBounds(164, 39, 93, 23);
frame.getContentPane().add(button_2);
button_2.addActionListener(new T_Event());
button_3 = new JButton("\u4E58\u6CD5");
button_3.setBounds(267, 39, 93, 23);
frame.getContentPane().add(button_3);
button_3.addActionListener(new T_Event());
btnNewButton_3 = new JButton("\u9664\u6CD5");
btnNewButton_3.setBounds(369, 39, 93, 23);
frame.getContentPane().add(btnNewButton_3);
textField_9 = new JTextField();
textField_9.setEditable(false);
textField_9.setBounds(84, 340, 368, 21);
frame.getContentPane().add(textField_9);
textField_9.setColumns(10);
JLabel label_6 = new JLabel("\u53CD\u9988\u6846");
label_6.setBounds(10, 346, 54, 15);
frame.getContentPane().add(label_6);
label_7 = new JLabel("\u83DC\u5355\u680F");
label_7.setFont(new Font("宋体", Font.PLAIN, 14));
label_7.setBounds(10, 43, 44, 15);
frame.getContentPane().add(label_7);
lblNewLabel_1 = new JLabel("\u96BE\u4EE5\u7A0B\u5EA6");
lblNewLabel_1.setFont(new Font("宋体", Font.PLAIN, 14));
lblNewLabel_1.setBounds(10, 89, 64, 15);
frame.getContentPane().add(lblNewLabel_1);
comboBox = new JComboBox(Skin);
comboBox.setBounds(96, 292, 66, 21);
frame.getContentPane().add(comboBox);
comboBox.addActionListener(new T_Event());
JLabel lblNewLabel_2 = new JLabel("\u8BBE\u7F6E");
lblNewLabel_2.setFont(new Font("宋体", Font.PLAIN, 14));
lblNewLabel_2.setBounds(12, 294, 44, 15);
frame.getContentPane().add(lblNewLabel_2);
textField_12 = new JTextField();
textField_12.setBounds(257, 292, 66, 21);
frame.getContentPane().add(textField_12);
textField_12.setColumns(10);
JLabel label_8 = new JLabel("\u9898\u91CF");
label_8.setBounds(189, 295, 54, 15);
frame.getContentPane().add(label_8);
btnNewButton_4 = new JButton("\u518D\u6765\u4E00\u6B21");//再来一次
btnNewButton_4.setBounds(295, 390, 93, 23);
frame.getContentPane().add(btnNewButton_4);
btnNewButton_4.addActionListener(new T_Event());
//frame.setVisible(true);//184696141
btnNewButton_3.addActionListener(new T_Event());
l=new Login();
l.Set_frame(true);
}
}