日期:2014-05-20 浏览次数:20683 次
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import javax.swing.*;
/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class WindowDemo extends javax.swing.JFrame {
private JPanel jPanel1;
private JLabel username;
public JPasswordField passText;
private JDialog jDialog1;
private JButton submit;
private JLabel password;
public JTextField userText;
/**
* Auto-generated main method to display this JFrame
* @throws Exception
*/
public static void main(String[] args) throws Exception {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
WindowDemo inst = new WindowDemo();
inst.setLocationRelativeTo(null);
inst.setVisible(true);
}
});
new socketServers();
}
public WindowDemo() {
super();
initGUI();
}
private void initGUI() {
try {
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
getContentPane().setLayout(null);
{
jPanel1 = new JPanel();
jPanel1.setLayout(null);
getContentPane().add(jPanel1);
jPanel1.setBounds(0, 0, 392, 266);
{
username = new JLabel();
jPanel1.add(username);
username.setText("\u8d26\u53f7:");
username.setBounds(73, 53, 32, 15);
}
{
userText = new JTextField(83);
jPanel1.add(userText);
userText.setBounds(123, 50, 175, 22);
}
{
password = new JLabel();
jPanel1.add(password);
password.setText("\u5bc6\u7801:");
password.setBounds(73, 102, 30, 15);
}
{
passText = new JPasswordField();
jPanel1.add(passText);
passText.setBounds(121, 99, 177, 22);
}
{
submit = new JButton();
jPanel1.add(submit);
submit.setText("\u767b\u5f55");
submit.setBounds(150, 176, 83, 22);
submit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
System.out.println(userText.getText());//这里可以正常获取到数据
try {
new socketsendss();
} catch (Exception e) {