?? servergui.java
字號:
/*
* ServerGUI.java
*
* Created on __DATE__, __TIME__
*/
package cn.edu.buaa.scse.liyi.network.server;
import java.util.List;
import cn.edu.buaa.scse.liyi.network.hibernate.bean.User;
/**
*
* @author __USER__
*/
public class ServerGUI extends javax.swing.JFrame {
private ICQServer server = new ICQServer();
private List<User> ulist;
/** Creates new form ServerGUI */
public ServerGUI() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
//GEN-BEGIN:initComponents
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel = new javax.swing.JPanel();
openSocketButton = new javax.swing.JButton();
jLabel = new javax.swing.JLabel();
closeSocketButton = new javax.swing.JButton();
jScrollPane = new javax.swing.JScrollPane();
userList = new javax.swing.JList();
setTitle("Socket \u670d\u52a1\u5668\u7aef");
setDefaultCloseOperation(3);
openSocketButton.setText("\u6253\u5f00\u670d\u52a1\u5668\u8fde\u63a5");
openSocketButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
openSocketButtonActionPerformed(evt);
}
});
jLabel.setText("\u5f53\u524d\u5728\u7ebf\u7528\u6237");
closeSocketButton.setText("\u5173\u95ed\u670d\u52a1\u5668\u8fde\u63a5");
closeSocketButton
.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
closeSocketButtonActionPerformed(evt);
}
});
userList.setModel(new javax.swing.AbstractListModel() {
String[] strings = {};
public int getSize() {
return strings.length;
}
public Object getElementAt(int i) {
return strings[i];
}
});
jScrollPane.setViewportView(userList);
javax.swing.GroupLayout jPanelLayout = new javax.swing.GroupLayout(
jPanel);
jPanel.setLayout(jPanelLayout);
jPanelLayout
.setHorizontalGroup(jPanelLayout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
jPanelLayout
.createSequentialGroup()
.addContainerGap()
.addGroup(
jPanelLayout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(
jScrollPane,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(
jPanelLayout
.createSequentialGroup()
.addComponent(
openSocketButton)
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(
closeSocketButton))
.addComponent(jLabel))
.addContainerGap(146, Short.MAX_VALUE)));
jPanelLayout
.setVerticalGroup(jPanelLayout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
jPanelLayout
.createSequentialGroup()
.addContainerGap()
.addGroup(
jPanelLayout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(
openSocketButton)
.addComponent(
closeSocketButton))
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel)
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(
jScrollPane,
javax.swing.GroupLayout.PREFERRED_SIZE,
218,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(18, Short.MAX_VALUE)));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addComponent(jPanel,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
layout.setVerticalGroup(layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING).addComponent(jPanel,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
pack();
}// </editor-fold>
//GEN-END:initComponents
private void closeSocketButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void openSocketButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
server.startServer();
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ServerGUI().setVisible(true);
}
});
}
//GEN-BEGIN:variables
// Variables declaration - do not modify
private javax.swing.JButton closeSocketButton;
private javax.swing.JLabel jLabel;
private javax.swing.JPanel jPanel;
private javax.swing.JScrollPane jScrollPane;
private javax.swing.JButton openSocketButton;
private javax.swing.JList userList;
// End of variables declaration//GEN-END:variables
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -