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

📄 readytosendfiles.java

📁 局域网聊天工具,学习java桌面应用程序的好例子,(代传)
💻 JAVA
字号:
/* * ReadyToSendFiles.java * * Created on 2008年10月30日, 下午10:39 */package ipmsg.gui;import ipmsg.etc.FileLinkList;import ipmsg.etc.GlobalVar;import javax.swing.DefaultListModel;/** * * @author  Noeru */public class ReadyToSendFiles extends javax.swing.JFrame {    /** Creates new form ReadyToSendFiles */    public ReadyToSendFiles() {        initComponents();        this.jList1.setListData(GlobalVar.exportPacketNo());        this.jLabel1.setText("接收方IP : ");        this.jLabel2.setText("接收方姓名 : ");    }    /** 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.     */    @SuppressWarnings("unchecked")    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents    private void initComponents() {        jPanel1 = new javax.swing.JPanel();        jScrollPane1 = new javax.swing.JScrollPane();        jList1 = new javax.swing.JList();        jPanel2 = new javax.swing.JPanel();        jScrollPane2 = new javax.swing.JScrollPane();        jList2 = new javax.swing.JList();        jLabel1 = new javax.swing.JLabel();        jLabel2 = new javax.swing.JLabel();        jSeparator1 = new javax.swing.JSeparator();        jPanel3 = new javax.swing.JPanel();        jButton1 = new javax.swing.JButton();        jButton2 = new javax.swing.JButton();        jButton3 = new javax.swing.JButton();        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("编号"));        jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);        jList1.addListSelectionListener(new javax.swing.event.ListSelectionListener() {            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {                jList1ValueChanged(evt);            }        });        jScrollPane1.setViewportView(jList1);        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);        jPanel1.setLayout(jPanel1Layout);        jPanel1Layout.setHorizontalGroup(            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE)        );        jPanel1Layout.setVerticalGroup(            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 232, Short.MAX_VALUE)        );        getContentPane().add(jPanel1, java.awt.BorderLayout.LINE_START);        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("详细信息"));        jScrollPane2.setViewportView(jList2);        jLabel1.setText("IP:");        jLabel2.setText("姓名:");        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);        jPanel2.setLayout(jPanel2Layout);        jPanel2Layout.setHorizontalGroup(            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)            .addGroup(jPanel2Layout.createSequentialGroup()                .addContainerGap()                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)                    .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 271, Short.MAX_VALUE)                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)                        .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)                        .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE)))                .addContainerGap())        );        jPanel2Layout.setVerticalGroup(            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel2Layout.createSequentialGroup()                .addComponent(jLabel1)                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                .addComponent(jLabel2)                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE))        );        getContentPane().add(jPanel2, java.awt.BorderLayout.CENTER);        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("控制"));        jButton1.setText("刷新");        jButton1.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton1ActionPerformed(evt);            }        });        jButton2.setText("删除");        jButton3.setText("关闭");        jButton3.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                jButton3ActionPerformed(evt);            }        });        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);        jPanel3.setLayout(jPanel3Layout);        jPanel3Layout.setHorizontalGroup(            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel3Layout.createSequentialGroup()                .addContainerGap()                .addComponent(jButton1)                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                .addComponent(jButton2)                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                .addComponent(jButton3)                .addContainerGap(233, Short.MAX_VALUE))        );        jPanel3Layout.setVerticalGroup(            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel3Layout.createSequentialGroup()                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(jButton1)                    .addComponent(jButton2)                    .addComponent(jButton3))                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))        );        getContentPane().add(jPanel3, java.awt.BorderLayout.SOUTH);        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();        setBounds((screenSize.width-450)/2, (screenSize.height-356)/2, 450, 356);    }// </editor-fold>//GEN-END:initComponentsprivate void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed// TODO add your handling code here:    this.jList1.setListData(GlobalVar.exportPacketNo());    this.jList2.setModel(new DefaultListModel());    this.jLabel1.setText("接收方IP : ");    this.jLabel2.setText("接收方姓名 : ");}//GEN-LAST:event_jButton1ActionPerformedprivate void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList1ValueChanged// TODO add your handling code here:    if(evt.getValueIsAdjusting())return;        if(this.jList1.getSelectedIndices().length==1){        int packetNo=Integer.parseInt((String)this.jList1.getSelectedValue());        FileLinkList flist=GlobalVar.getFileList(packetNo);        if(flist==null)return;        this.jLabel1.setText("接收方IP : "+flist.getIp());        this.jLabel2.setText("接收方姓名 : "+                GlobalVar.getUser(flist.getIp()).getName());        this.jList2.setListData(flist.exportFileList());    }}//GEN-LAST:event_jList1ValueChangedprivate void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed// TODO add your handling code here:    this.dispose();}//GEN-LAST:event_jButton3ActionPerformed    // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JButton jButton1;    private javax.swing.JButton jButton2;    private javax.swing.JButton jButton3;    private javax.swing.JLabel jLabel1;    private javax.swing.JLabel jLabel2;    private javax.swing.JList jList1;    private javax.swing.JList jList2;    private javax.swing.JPanel jPanel1;    private javax.swing.JPanel jPanel2;    private javax.swing.JPanel jPanel3;    private javax.swing.JScrollPane jScrollPane1;    private javax.swing.JScrollPane jScrollPane2;    private javax.swing.JSeparator jSeparator1;    // End of variables declaration//GEN-END:variables    private void loadFileList(){        this.jList1.setListData(GlobalVar.exportPacketNo());    }}

⌨️ 快捷键说明

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