⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 validate.java

📁 本工程模拟网上社区,其中包括银行,软件销售公司,软件投资公司,茶餐馆,和多个服务器.
💻 JAVA
字号:
package investcompanyclient;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JLabel;import javax.swing.JPasswordField;import javax.swing.JTextField;import javax.swing.WindowConstants;import javax.swing.SwingUtilities;import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.IOException;import java.io.InputStreamReader;import java.io.OutputStreamWriter;import java.io.PrintWriter;import java.net.*;import java.io.*;import javax.swing.*;import java.util.*;import java.awt.*;public class validate extends javax.swing.JFrame {	private JLabel jLabel1;	private JLabel jLabel2;	private JButton jButton2;	private JButton jButton1;	private JTextField jTextField1;	private Socket socket;	private BufferedReader in;	private PrintWriter out;	private JPasswordField jPasswordField1;	public validate(Socket s) {		super();		socket = s;		try {			in = new BufferedReader(new InputStreamReader(socket					.getInputStream()));			out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(					socket.getOutputStream())), true);		} catch (IOException e) {			System.out.println(e);		}		initGUI();	}		private void initGUI() {		try {			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);			getContentPane().setLayout(null);			this.setTitle("\u9a8c\u8bc1\u4e2d\u3002\u3002\u3002\u3002\u3002");			this.setLocation(new java.awt.Point(400, 180));			{				jLabel1 = new JLabel();				getContentPane().add(jLabel1);				jLabel1.setText("\u7528\u6237\u540d\uff1a");				jLabel1.setBounds(44, 84, 83, 29);			}			{				jTextField1 = new JTextField();				getContentPane().add(jTextField1);				jTextField1.setBounds(149, 84, 197, 35);			}			{				jLabel2 = new JLabel();				getContentPane().add(jLabel2);				jLabel2.setText("\u5bc6\u7801\uff1a");				jLabel2.setBounds(44, 171, 53, 28);			}			{				jButton1 = new JButton();				getContentPane().add(jButton1);				jButton1.setText("\u786e\u5b9a");				jButton1.setBounds(56, 260, 112, 37);				jButton1.addActionListener(new ActionListener() {					public void actionPerformed(ActionEvent evt) {						jButton1ActionPerformed(evt);					}				});			}			{				jButton2 = new JButton();				getContentPane().add(jButton2);				jButton2.setText("\u53d6\u6d88");				jButton2.setBounds(205, 261, 141, 36);				jButton2.addActionListener(new ActionListener() {					public void actionPerformed(ActionEvent evt) {						jButton2ActionPerformed(evt);					}				});			}			{				jPasswordField1 = new JPasswordField();				getContentPane().add(jPasswordField1);				jPasswordField1.setBounds(149, 166, 186, 27);			}			pack();			this.setSize(410, 374);		} catch (Exception e) {			e.printStackTrace();		}	}	private void jButton2ActionPerformed(ActionEvent evt) {              this.dispose();              this.setVisible(false);	}	private void jButton1ActionPerformed(ActionEvent evt) {		try {			String id = jTextField1.getText();			String code = new String(jPasswordField1.getPassword());			String temp = "validate" + "/" + id + "/" + code; 			out.println(temp);			out.flush();			String ans = in.readLine();			if (!ans.equals("false")) {				StringTokenizer stn = new StringTokenizer(ans.trim(), "/");				String[] t = { " ", " ", " ", " ", " ", " " };				int i = 0;				while (stn.hasMoreTokens()) {					t[i] = stn.nextToken();					i++;				}				this.setVisible(false);				Frame02  hf = new Frame02(socket,t[1]);				hf.setVisible(true);			} else {				JOptionPane.showMessageDialog(null, "你无权发布项目!");				jTextField1.setText("");				jPasswordField1.setText("");			}		} catch (IOException e) {			System.out.println(e);		}                          	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -