package four;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import lombok.Data;
/**
* 登录面板,登录成功即跳转页面到客户端
*
* @author czx
*
*/
@Data
public class Coon {
private JFrame frame;
private JTextField textField;
private JTextField textField_1;
String host;
int port;
String cm;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Coon window = new Coon();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Coon() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setTitle("");
frame.setBounds(100, 100, 448, 156);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel();
frame.getContentPane().add(panel, BorderLayout.NORTH);
JLabel lblNewLabel = new JLabel("\u8FDE\u63A5\u4FE1\u606F");
panel.add(lblNewLabel);
textField = new JTextField();
textField.setText("127.0.0.1");
panel.add(textField);
textField.setColumns(10);
textField_1 = new JTextField();
textField_1.setText("10086");
panel.add(textField_1);
textField_1.setColumns(5);
JButton btnNewButton = new JButton("\u8FDE\u63A5");
btnNewButton.addActionListener(new ActionListener() {
@SuppressWarnings("unused")
public void actionPerformed(ActionEvent e) {
host = textField.getText();
cm = textField_1.getText();
if (host != null && cm != null) {
port = Integer.valueOf(cm);
VoteClient vc = new VoteClient(host, port);
frame.dispose();
}
}
});
panel.add(btnNewButton);
}
}