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

📄 testform.java

📁 简单的基于java的音频聊天系统 p2p模式 喜欢大家喜欢
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * TestForm.java
 *
 * Created on __DATE__, __TIME__
 */

package org.phyeas.server.test;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Array;
import java.net.Socket;
import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.swing.JOptionPane;
import javax.swing.ListModel;

/**
 * 
 * @author __USER__
 */
public class TestForm extends javax.swing.JFrame {
	private static final long serialVersionUID = 1L;

	private boolean linked;

	private Socket socket;
	private OutputStream out;
	private Revicer revicer = null;

	/** Creates new form TestForm */
	public TestForm() {
		initComponents();
		setTexts();
	}

	// GEN-BEGIN:initComponents
	// <editor-fold defaultstate="collapsed" desc="Generated Code">
	private void initComponents() {

		jLabel1 = new javax.swing.JLabel();
		txtServer = new javax.swing.JTextField();
		jLabel2 = new javax.swing.JLabel();
		txtPort = new javax.swing.JTextField();
		jLabel3 = new javax.swing.JLabel();
		jScrollPane1 = new javax.swing.JScrollPane();
		lstGroup = new javax.swing.JList();
		jLabel4 = new javax.swing.JLabel();
		jScrollPane2 = new javax.swing.JScrollPane();
		lstUser = new javax.swing.JList();
		btnLink = new javax.swing.JButton();
		btnRefGroup = new javax.swing.JButton();
		btnRefUsers = new javax.swing.JButton();
		btnJoinGroup = new javax.swing.JButton();
		txtGroupName = new javax.swing.JTextField();
		jLabel5 = new javax.swing.JLabel();
		jLabel6 = new javax.swing.JLabel();
		lblGroupName = new javax.swing.JLabel();
		btnExitGroup = new javax.swing.JButton();
		jLabel8 = new javax.swing.JLabel();
		txtID = new javax.swing.JTextField();
		jLabel9 = new javax.swing.JLabel();
		txtName = new javax.swing.JTextField();
		jScrollPane3 = new javax.swing.JScrollPane();
		txtReviceData = new javax.swing.JTextArea();
		jLabel10 = new javax.swing.JLabel();
		jLabel11 = new javax.swing.JLabel();
		txtSendData = new javax.swing.JTextField();
		btnSend = new javax.swing.JButton();

		setDefaultCloseOperation(3);

		jLabel1.setText("\u670d\u52a1\u5668IP");

		txtServer.setText("127.0.0.1");

		jLabel2.setText("\u7aef\u53e3");

		txtPort.setText("5000");

		jLabel3.setText("\u7fa4\u7ec4:");

		lstGroup.setModel(new javax.swing.AbstractListModel() {
			String[] strings = { "ww" };

			public int getSize() {
				return strings.length;
			}

			public Object getElementAt(int i) {
				return strings[i];
			}
		});
		lstGroup
				.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
					public void valueChanged(
							javax.swing.event.ListSelectionEvent evt) {
						lstGroupValueChanged(evt);
					}
				});
		jScrollPane1.setViewportView(lstGroup);

		jLabel4.setText("\u6210\u5458\u5217\u8868");

		jScrollPane2.setViewportView(lstUser);

		btnLink.setText("\u8fde\u63a5");
		btnLink.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnLinkActionPerformed(evt);
			}
		});

		btnRefGroup.setText("\u5237\u65b0\u5217\u8868");
		btnRefGroup.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnRefGroupActionPerformed(evt);
			}
		});

		btnRefUsers.setText("\u5237\u65b0\u5217\u8868");
		btnRefUsers.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnRefUsersActionPerformed(evt);
			}
		});

		btnJoinGroup.setText("\u521b\u5efa/\u52a0\u5165\u7fa4\u7ec4");
		btnJoinGroup.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnJoinGroupActionPerformed(evt);
			}
		});

		jLabel5.setText("\u7fa4\u7ec4\u540d\u79f0");

		jLabel6.setText("\u5f53\u524d\u6240\u5728\u7fa4\u7ec4");

		lblGroupName.setText("\u65e0");

		btnExitGroup.setText("\u9000\u51fa\u7fa4\u7ec4");
		btnExitGroup.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnExitGroupActionPerformed(evt);
			}
		});

		jLabel8.setText("ID");

		jLabel9.setText("\u540d\u79f0");

		txtReviceData.setColumns(20);
		txtReviceData.setRows(5);
		jScrollPane3.setViewportView(txtReviceData);

		jLabel10.setText("\u63a5\u6536\u5230\u7684\u6d88\u606f");

		jLabel11.setText("\u53d1\u9001\u6d88\u606f");

		btnSend.setText("\u53d1\u9001");
		btnSend.addActionListener(new java.awt.event.ActionListener() {
			public void actionPerformed(java.awt.event.ActionEvent evt) {
				btnSendActionPerformed(evt);
			}
		});

		org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
				getContentPane());
		getContentPane().setLayout(layout);
		layout
				.setHorizontalGroup(layout
						.createParallelGroup(
								org.jdesktop.layout.GroupLayout.LEADING)
						.add(
								layout
										.createSequentialGroup()
										.addContainerGap()
										.add(
												layout
														.createParallelGroup(
																org.jdesktop.layout.GroupLayout.LEADING)
														.add(
																layout
																		.createSequentialGroup()
																		.add(
																				layout
																						.createParallelGroup(
																								org.jdesktop.layout.GroupLayout.LEADING)
																						.add(
																								org.jdesktop.layout.GroupLayout.TRAILING,
																								layout
																										.createSequentialGroup()
																										.add(
																												jLabel10)
																										.addPreferredGap(
																												org.jdesktop.layout.LayoutStyle.UNRELATED))
																						.add(
																								layout
																										.createSequentialGroup()
																										.add(
																												jLabel11)
																										.add(
																												34,
																												34,
																												34)))
																		.add(
																				layout
																						.createParallelGroup(
																								org.jdesktop.layout.GroupLayout.LEADING)
																						.add(
																								jScrollPane3,
																								org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
																								316,
																								org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
																						.add(
																								layout
																										.createSequentialGroup()
																										.add(
																												txtSendData,
																												org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
																												249,
																												org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
																										.addPreferredGap(
																												org.jdesktop.layout.LayoutStyle.UNRELATED)
																										.add(
																												btnSend))))
														.add(
																layout
																		.createSequentialGroup()
																		.add(
																				layout
																						.createParallelGroup(
																								org.jdesktop.layout.GroupLayout.LEADING,
																								false)
																						.add(
																								layout
																										.createSequentialGroup()
																										.add(
																												layout
																														.createParallelGroup(
																																org.jdesktop.layout.GroupLayout.LEADING)
																														.add(
																																jLabel3)
																														.add(
																																jLabel5))
																										.add(
																												35,
																												35,
																												35)
																										.add(
																												layout
																														.createParallelGroup(
																																org.jdesktop.layout.GroupLayout.LEADING,
																																false)
																														.add(
																																btnRefGroup)
																														.add(
																																org.jdesktop.layout.GroupLayout.TRAILING,
																																jScrollPane1,
																																0,
																																0,
																																Short.MAX_VALUE)
																														.add(
																																layout
																																		.createSequentialGroup()
																																		.add(
																																				txtGroupName,
																																				org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
																																				136,
																																				org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
																																		.addPreferredGap(
																																				org.jdesktop.layout.LayoutStyle.RELATED))))
																						.add(
																								layout
																										.createSequentialGroup()
																										.add(
																												jLabel6)
																										.addPreferredGap(
																												org.jdesktop.layout.LayoutStyle.RELATED)
																										.add(
																												lblGroupName,
																												org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
																												org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
																												Short.MAX_VALUE)))
																		.addPreferredGap(
																				org.jdesktop.layout.LayoutStyle.RELATED)
																		.add(
																				jLabel4)
																		.addPreferredGap(
																				org.jdesktop.layout.LayoutStyle.RELATED)
																		.add(
																				layout
																						.createParallelGroup(
																								org.jdesktop.layout.GroupLayout.LEADING)
																						.add(
																								btnExitGroup)
																						.add(
																								btnRefUsers)
																						.add(
																								btnJoinGroup)
																						.add(
																								jScrollPane2,
																								org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
																								131,
																								org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
														.add(
																layout
																		.createSequentialGroup()
																		.add(
																				layout
																						.createParallelGroup(
																								org.jdesktop.layout.GroupLayout.LEADING)
																						.add(
																								jLabel1)
																						.add(
																								jLabel8))
																		.add(
																				35,
																				35,
																				35)
																		.add(
																				layout
																						.createParallelGroup(
																								org.jdesktop.layout.GroupLayout.LEADING,
																								false)
																						.add(
																								txtID)
																						.add(
																								txtServer,
																								org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
																								142,
																								Short.MAX_VALUE))
																		.addPreferredGap(
																				org.jdesktop.layout.LayoutStyle.RELATED)
																		.add(
																				layout
																						.createParallelGroup(
																								org.jdesktop.layout.GroupLayout.LEADING,
																								false)
																						.add(
																								layout
																										.createSequentialGroup()
																										.add(
																												jLabel2)
																										.add(
																												18,
																												18,
																												18)
																										.add(
																												txtPort,
																												org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
																												46,
																												org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
																										.add(
																												18,
																												18,
																												18)
																										.add(
																												btnLink))
																						.add(
																								layout
																										.createSequentialGroup()
																										.add(
																												jLabel9)
																										.add(
																												18,
																												18,
																												18)
																										.add(
																												txtName)))))
										.addContainerGap(24, Short.MAX_VALUE)));
		layout
				.setVerticalGroup(layout
						.createParallelGroup(
								org.jdesktop.layout.GroupLayout.LEADING)
						.add(
								layout
										.createSequentialGroup()
										.addContainerGap()
										.add(
												layout
														.createParallelGroup(
																org.jdesktop.layout.GroupLayout.BASELINE)
														.add(jLabel1)
														.add(jLabel2)
														.add(
																txtPort,
																org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
																org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
																org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
														.add(btnLink)
														.add(
																txtServer,
																org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
																org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
																org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												org.jdesktop.layout.LayoutStyle.RELATED)
										.add(
												layout
														.createParallelGroup(
																org.jdesktop.layout.GroupLayout.BASELINE)
														.add(jLabel8)
														.add(
																txtID,
																org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
																org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
																org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
														.add(jLabel9)
														.add(
																txtName,
																org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
																org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
																org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
										.add(27, 27, 27)
										.add(
												layout
														.createParallelGroup(
																org.jdesktop.layout.GroupLayout.LEADING)
														.add(jLabel3)
														.add(jLabel4)
														.add(

⌨️ 快捷键说明

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