ADD file via upload

master
aufe20203871 3 years ago
parent 60b6038e49
commit 7725bb77ef

@ -0,0 +1,193 @@
package view;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import database.Landing;
/**
* <20><>½<EFBFBD><C2BD><EFBFBD><EFBFBD>
*
* @author K.X
*
*/
public class Land {
/*
* <20><><EFBFBD><EFBFBD><E5B4B0> һ<><D2BB><EFBFBD><EFBFBD><EFBFBD>ǩ <20><><EFBFBD><EFBFBD>С<EFBFBD><D0A1>ǩ <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ť <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
// <20><>ǩ
private JLabel jLabel = new JLabel("ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD>ϵͳ");
private JLabel jLabel2 = new JLabel("<22><> <20>ţ<EFBFBD> ");
private JLabel jLabel3 = new JLabel("<22><> <20>룺 ");
// <20><><EFBFBD><EFBFBD>
private Font font = new Font("<22><><EFBFBD><EFBFBD>", Font.BOLD, 40);
private Font font2 = new Font("<22><><EFBFBD><EFBFBD>", Font.BOLD, 25);
private Font font3 = new Font("<22><><EFBFBD><EFBFBD>", Font.BOLD, 20);
// <20>ı<EFBFBD><C4B1><EFBFBD>
private JTextField field = new JTextField(22);
private JPasswordField field2 = new JPasswordField(22);
// <20><>ť
private JButton button = new JButton("<22><>½");
private JButton button2 = new JButton("ע<><D7A2>");
// <20><><EFBFBD>
private JPanel jPanel = new JPanel();
private JPanel jPanel2 = new JPanel();
private JPanel jPanel3 = new JPanel();
private JPanel jPanel4 = new JPanel();
private JPanel jPanel5 = new JPanel();
// <20><><EFBFBD><EFBFBD>
private JFrame frame = new JFrame("<22><>½");
// <20><>С
private Dimension dimension = new Dimension(30, 30);
private Dimension dimension2 = new Dimension(100, 50);
public String user;
private String password;
public Land() {
frame.setTitle("<22><>½");
// <20><><EFBFBD>ô<EFBFBD>С
frame.setSize(550, 500);
// <20><><EFBFBD><EFBFBD>
frame.setLocationRelativeTo(null);
// <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
frame.setLayout(null);
// <20>ı<C4B1><E4B4B0>ͼ<EFBFBD><CDBC>
Toolkit t = Toolkit.getDefaultToolkit();
Image image = t.getImage("img\\top.jpg");
frame.setIconImage(image);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
addassembly();
// <20><><EFBFBD><EFBFBD>͸<EFBFBD><CDB8>
transparent();
// <20><><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD>
addEvent();
// <20>ı<C4B1><E4B1B3>ͼƬ
Icon i = new ImageIcon("img\\land1.jpg");
JLabel Label = new JLabel(i);
Label.setBounds(0, 0, 550, 500);
frame.add(Label);
// <20><><EFBFBD><EFBFBD><EFBFBD>Ըı<C4B1><E4B4B0>Ĵ<EFBFBD>С
frame.setResizable(false);
// <20><><EFBFBD>ڹر<DAB9>
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// <20><><EFBFBD>ڿɼ<DABF>
frame.setVisible(true);
}
private void addassembly() {
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
jLabel.setFont(font);
jLabel2.setFont(font2);
jLabel3.setFont(font2);
button.setFont(font3);
button2.setFont(font3);
field.setFont(font3);
field2.setFont(font3);
field.setPreferredSize(dimension);
field2.setPreferredSize(dimension);
button.setPreferredSize(dimension2);
button2.setPreferredSize(dimension2);
// button.setBackground(Color.pink);
// button2.setBackground(Color.GRAY);
jPanel.add(jLabel);
jPanel2.add(jLabel2);
jPanel2.add(field);
jPanel3.add(jLabel3);
jPanel3.add(field2);
jPanel4.add(button);
jPanel5.add(button2);
jPanel.setBounds(0, 60, 550, 80);
jPanel2.setBounds(0, 160, 550, 80);
jPanel3.setBounds(0, 250, 550, 60);
jPanel4.setBounds(100, 325, 150, 80);
jPanel5.setBounds(275, 325, 150, 80);
frame.add(jPanel);
frame.add(jPanel2);
frame.add(jPanel3);
frame.add(jPanel4);
frame.add(jPanel5);
}
private void transparent() {
// <20><><EFBFBD><EFBFBD>͸<EFBFBD><CDB8>
jLabel.setOpaque(false);
jLabel2.setOpaque(false);
jLabel3.setOpaque(false);
field.setOpaque(false);
field2.setOpaque(false);
// button.setOpaque(false);
// button2.setOpaque(false);
jPanel.setOpaque(false);
jPanel2.setOpaque(false);
jPanel3.setOpaque(false);
jPanel4.setOpaque(false);
jPanel5.setOpaque(false);
}
private void addEvent() {
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
user = field.getText().trim();
password = field2.getText().trim();
if(Landing.test(user, password)) {
// JOptionPane.showMessageDialog(null, "<22><>½<EFBFBD>ɹ<EFBFBD>");
frame.dispose();
new MainInterface(user);
}else {
empty();
}
}
});
button2.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
//frame.setVisible(false);
frame.dispose();
new Register();
}
});
}
private void empty() {
field.setText("");
field2.setText("");
}
}
Loading…
Cancel
Save