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

📄 getconfig.java

📁 本视频会议服务器端代码:根据自己定义的协议:能构穿透nat 需要java jmf框架 * 我开放源代码是为了更好的让java这门程序艺术更好的发展
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * Main.java
 *
 * 主服务器的开发从今天开始了从今天起 可能要遇到技术上的难题 
 * 但是这些是成长的经历中必须要面临的熟悉的资料已经熟悉的差不多了
 * 开始进入了开发的阶段    
 *                             2008年1月3日, 下午2:22
 *
 *
 * 
 */
/*
 *     程序员杨龙:本视频会议服务器端代码:根据自己定义的协议:能构穿透nat 需要java jmf框架
 *     我开放源代码是为了更好的让java这门程序艺术更好的发展:您可以研究代码,您可以自己使用
 *     但是不要使用在商业用途上 让我们更好的把开源事业在中国做下去
 *     2008年 3月  杨龙 完成服务器端的框架 
 *     信箱 :y_flash@163.com
 *     QQ:274797328
 *     www.0351soft.com   www.lx08.com  
 */

package ytp.javaserver.server;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import javax.swing.JOptionPane;

/**
 *
 * @author  Administrator
 */
public class getConfig extends javax.swing.JFrame {
    
    /** Creates new form getConfig */
    public getConfig() {
        initComponents();
    }
    public void reset()
    {
                
        try
        {
            jCip.removeAllItems();
        String hostName = InetAddress.getLocalHost().getLocalHost().getHostName();
        InetAddress[] inet = InetAddress.getAllByName(hostName);
        for(int index=0;index<inet.length;index++) {
            jCip.addItem(inet[index].getHostAddress());
        }
            File file = new File("config/config.dat");
       
        if(file.exists())
        {
            //配置文件存在
            
             FileInputStream fileIn = new FileInputStream(file);
             int fileSize = fileIn.available();
             byte[] byteRead = new byte[fileSize+1];
             String strTemp = null;
             //文件中有可以配置的信息
             if(fileSize>0)
             {
                 fileIn.read(byteRead);
                 strTemp = new String(byteRead);  //构造配置文件字符串
                 String[] strs = strTemp.split("&");
                 for(int i=0; i<strs.length;i++)
                 {
                     //各自将信息写入到需要的文件框中
                     if(strs[i].startsWith("IP:")||strs[i].startsWith("ip:"))
                     {
                         jLip.setText(strs[i].substring(3));
                     }
                     if(strs[i].startsWith("port:")||strs[i].startsWith("PORT:"))
                     {
                         jLport.setText(strs[i].substring(5));
                     }
                     if(strs[i].startsWith("configPath:")||strs[i].startsWith("ConfigPath:"))
                     {
                        jLconPath.setText(strs[i].substring(11));
                     }
                     if(strs[i].startsWith("Mediapath:")||strs[i].startsWith("Mediapath:"))
                     {
                         jLmediaPath.setText(strs[i].substring(10));
                     }
                      if(strs[i].startsWith("time:")||strs[i].startsWith("time:"))
                     {
                         jLinfo.setText("您上次配置服务器信息时间是:"+strs[i].substring(5));
                     }
                    
                 }
                 
             }else  //文件中没有可以配置的信息
             {
                 jLinfo.setText("您的服务器配置信息为空!请确认您已经配置过您的服务器:");
             }
             //读入配置信息 填充到
             
        }else
        {
            jLinfo.setText("您这是首次配置您的服务器!");
        }
        
    }catch(UnknownHostException e)
    {
        JOptionPane.showMessageDialog(this,e.toString());
    }catch(FileNotFoundException e)
    {
        JOptionPane.showMessageDialog(this,e.toString());
       
    }catch(IOException e)
    {
        JOptionPane.showMessageDialog(this,e.toString());
    }

    }
    /** 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.
     */
    // <editor-fold defaultstate="collapsed" desc=" 生成的代码 ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jLabel1 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLip = new javax.swing.JLabel();
        jLport = new javax.swing.JLabel();
        jLmediaPath = new javax.swing.JLabel();
        jLconPath = new javax.swing.JLabel();
        jLtime = new javax.swing.JLabel();
        jLinfo = new javax.swing.JLabel();
        jCip = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        jLabel1.setText("\u67e5\u770b\u670d\u52a1\u5668\u914d\u7f6e\u4fe1\u606f");

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jLabel2.setText("\u670d\u52a1\u5668IP\u5730\u5740:");

        jLabel3.setText("\u670d\u52a1\u5668\u7aef\u53e3:");

        jLabel4.setText("\u5a92\u4f53\u5b58\u653e\u5730\u5740:");

        jLabel5.setText("\u914d\u7f6e\u6587\u4ef6\u5730\u5740:");

        jLabel6.setText("\u914d\u7f6e\u6587\u4ef6\u4fee\u6539\u65f6\u95f4:");

        jLabel7.setText("\u670d\u52a1\u5668\u73b0\u5728\u72b6\u6001:");

        jLip.setText("jLabel8");

        jLport.setText("jLabel8");

        jLmediaPath.setText("jLabel8");

        jLconPath.setText("jLabel8");

        jLtime.setText("jLabel8");

        jLinfo.setText("jLabel8");

        jCip.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jLabel8.setText("\u6240\u6709IP\u5217\u8868:");

        jButton1.setText("\u4fee\u6539\u914d\u7f6e\u4fe1\u606f");
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {

⌨️ 快捷键说明

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