• 大小: 42KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: Java
  • 标签: java  p2p  文件传输  

资源简介

基于java的p2p文件传输代码.rar

资源截图

代码片段和文件信息

package com.tarena.file.gui;

import com.tarena.file.service.*;

public class Loginframe extends javax.swing.Jframe {
    private ClientContext context;
    public Loginframe(ClientContext context) {
        this.context = context;
        initComponents();
        ExamTools.setframeCenterPoint(this);
        this.setResizable(false);
    }

    public String getHost() {
        return addrText.getText().trim();
    }

    public int getPort() {
        return Integer.parseInt(portText.getText().trim());
    }

    // //GEN-BEGIN:initComponents
    private void initComponents() {

        buttons = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        addrText = new javax.swing.JTextField();
        portText = new javax.swing.JTextField();
        loginButton = new javax.swing.JButton();
        serverRadio = new javax.swing.JRadioButton();
        clientRadio = new javax.swing.JRadioButton();
        exitButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        settitle(“P2P文件传输程序“); // NOI18N
        setAlwaysOnTop(true);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jPanel1.setBackground(new java.awt.Color(255 255 255));
        jPanel1.setName(“jPanel1“); // NOI18N

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource(“/com/tarena/file/resource/logo.PNG“))); // NOI18N
        jLabel1.setName(“jLabel1“); // NOI18N

        jLabel2.setText(“IP地址:“);
        jLabel2.setName(“jLabel2“); // NOI18N

        jLabel3.setText(“端口号:“);
        jLabel3.setName(“jLabel3“); // NOI18N

        addrText.setText(“127.0.0.1“);
        addrText.setName(“addrText“); // NOI18N
        addrText.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addrTextActionPerformed(evt);
            }
        });

        portText.setText(“6860“);
        portText.setName(“portText“); // NOI18N

        loginButton.setText(“登录“);
        loginButton.setName(“loginButton“); // NOI18N
        loginButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                loginButtonActionPerformed(evt);
            }
        });

        serverRadio.setBackground(new java.awt.Color(255 255 255));
        buttons.add(serverRadio);
        serverRadio.setSelected(true);
        serverRadio.setText(“我是服务器“);
        serverRadio.setName(“serverRadio“); // NOI18N

        clientRadio.setBackground(new java.awt.Color(255 255 255));
        but

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        390  2011-02-27 20:15  FlieSendSystem\.project

     文件      12040  2011-02-27 20:26  FlieSendSystem\src\com\tarena\file\service\ClientContext.java

     文件        564  2011-02-27 20:28  FlieSendSystem\src\com\tarena\file\service\ExamTools.java

     文件       1789  2011-02-27 20:16  FlieSendSystem\src\com\tarena\file\resource\logo.PNG

     文件      10816  2011-02-27 20:16  FlieSendSystem\src\com\tarena\file\gui\Loginframe.form

     文件       9208  2011-02-27 20:28  FlieSendSystem\src\com\tarena\file\gui\Loginframe.java

     文件      22833  2011-02-27 20:16  FlieSendSystem\src\com\tarena\file\gui\Menuframe.form

     文件      20248  2011-02-27 20:31  FlieSendSystem\src\com\tarena\file\gui\Menuframe.java

     文件      10816  2011-02-27 20:16  FlieSendSystem\bin\com\tarena\file\gui\Loginframe.form

     文件      22833  2011-02-27 20:16  FlieSendSystem\bin\com\tarena\file\gui\Menuframe.form

     文件       7823  2011-02-27 20:28  FlieSendSystem\bin\com\tarena\file\gui\Loginframe.class

     文件      11345  2011-02-27 20:31  FlieSendSystem\bin\com\tarena\file\gui\Menuframe.class

     文件        817  2011-02-27 20:28  FlieSendSystem\bin\com\tarena\file\gui\Loginframe$3.class

     文件        817  2011-02-27 20:28  FlieSendSystem\bin\com\tarena\file\gui\Loginframe$2.class

     文件        790  2011-02-27 20:28  FlieSendSystem\bin\com\tarena\file\gui\Loginframe$1.class

     文件        817  2011-02-27 20:28  FlieSendSystem\bin\com\tarena\file\gui\Loginframe$4.class

     文件        810  2011-02-27 20:31  FlieSendSystem\bin\com\tarena\file\gui\Menuframe$1.class

     文件        810  2011-02-27 20:31  FlieSendSystem\bin\com\tarena\file\gui\Menuframe$2.class

     文件       1789  2011-02-27 20:16  FlieSendSystem\bin\com\tarena\file\resource\logo.PNG

     文件       6816  2011-02-27 20:26  FlieSendSystem\bin\com\tarena\file\service\ClientContext.class

     文件       2166  2011-02-27 20:26  FlieSendSystem\bin\com\tarena\file\service\ClientContext$1.class

     文件       2693  2011-02-27 20:26  FlieSendSystem\bin\com\tarena\file\service\ClientContext$ReadThread$1.class

     文件       2677  2011-02-27 20:26  FlieSendSystem\bin\com\tarena\file\service\ClientContext$ReadThread$2.class

     文件       6775  2011-02-27 20:26  FlieSendSystem\bin\com\tarena\file\service\ClientContext$ReadThread.class

     文件       1124  2011-02-27 20:28  FlieSendSystem\bin\com\tarena\file\service\ExamTools.class

     文件        629  2011-02-27 20:15  FlieSendSystem\.settings\org.eclipse.jdt.core.prefs

     文件        301  2011-02-27 20:15  FlieSendSystem\.classpath

     目录          0  2011-02-27 20:16  FlieSendSystem\src\com\tarena\file\service

     目录          0  2011-02-27 20:16  FlieSendSystem\src\com\tarena\file\resource

     目录          0  2011-02-27 20:16  FlieSendSystem\src\com\tarena\file\gui

............此处省略16个文件信息

评论

共有 条评论