资源简介

正在学java,自己写的小程序。功能很简单,但花了不少功夫~~关键是自己慢慢从无到有的一个过程,供初学者参考。

资源截图

代码片段和文件信息

package m_interface; //窗口类 该类调用了本包中的其它所有封装类,用以建立窗口界面

import java.awt.event.ActionListener;

import javax.swing.*;

import m_UDP.Client_UDP_Receiver;

import static java.awt.BorderLayout.*;

public class ClientInterface extends Jframe {

// 变量的定义

public static JButton send_msg;
public static JButton send_ip;
public static JTextArea m_show;
public static JTextField m_in;
public static Jframe main_frame;
public static JTextField m_ip;
Listener_send_msg listener_send_msg = null;
Listener_ta_input_ip listener_ta_input_ip = null;
Listener_send_ip listener_send_ip = null;
Listener_ta_local_ip listener_ta_local_ip = null;
Listener_ta_m_friend listener_ta_m_friend = null;
JPanel m_south_panel;
public static JPanel m_north_panel;
JMenuBar menubar;
JMenu menu_talk menu_setting menu_translate;
JMenuItem ta_m_friend ta_local_ip ta_input_ip;

// 构造函数

public ClientInterface(String s int x int y int h int w) {
main_frame = new Jframe(s);
main_frame.setBounds(x y w h);
main_frame.setVisible(true);
main_frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
init();
setClientInterface();
// start_thread();
}

// 变量的初始化函数

public void init() {
listener_send_msg = new Listener_send_msg();
listener_ta_input_ip = new Listener_ta_input_ip();
listener_send_ip = new Listener_send_ip();
listener_ta_local_ip = new Listener_ta_local_ip();
listener_ta_m_friend = new Listener_ta_m_friend();
send_msg = new JButton(“发送“);
send_ip = new JButton(“确定“);
m_south_panel = new JPanel();
m_north_panel = new JPanel();
m_show = new JTextArea();
m_show.setEditable(false);
m_in = new JTextField(10);
m_ip = new JTextField(“127.0.0.1“ 10);
menubar = new JMenuBar();
menu_talk = new JMenu(“聊天“);
menu_setting = new JMenu(“设置“);
menu_translate = new JMenu(“传输“);
ta_m_friend = new JMenuItem(“我的好友“ new ImageIcon(“Image/路易斯02.jif“));
ta_local_ip = new JMenuItem(“显示本机IP“ new ImageIcon(“Image/路易斯03.jif“));
ta_input_ip = new JMenuItem(“输 入IP“ new ImageIcon(“Image/谢斯塔01.jif“));
send_msg.addActionListener(listener_send_msg);
ta_input_ip.addActionListener(listener_ta_input_ip);
send_ip.addActionListener(listener_send_ip);
ta_local_ip.addActionListener(listener_ta_local_ip);
ta_m_friend.addActionListener(listener_ta_m_friend);
Listener_ta_input_ip.init(“输入IP“100 200 300 100);
Listener_ta_m_friend.init(“我的好友“300 200300 400);
}

// 界面布局

public void setClientInterface() {
menu_talk.add(ta_m_friend);
menu_talk.add(ta_local_ip);
menu_talk.add(ta_input_ip);
menubar.add(menu_talk);
menubar.add(menu_setting);
menubar.add(menu_translate);
m_south_panel.add(m_in);
m_south_panel.add(send_msg);
m_north_panel.add(m_ip);
m_north_panel.add(send_ip);
main_frame.setJMenuBar(menubar);
main_frame.add(m_south_panel SOUTH);
main_frame.add(m_show CENTER);
main_frame.setVisible(true);
}

}

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

     文件        301  2011-10-01 15:13  m_talker_Client beta0.4\.classpath

     文件        399  2011-10-03 08:33  m_talker_Client beta0.4\.project

     文件        629  2011-10-01 15:13  m_talker_Client beta0.4\.settings\org.eclipse.jdt.core.prefs

     文件       3708  2011-10-03 08:33  m_talker_Client beta0.4\bin\m_interface\ClientInterface.class

     文件       1316  2011-10-03 08:33  m_talker_Client beta0.4\bin\m_interface\Listener_send_ip.class

     文件       1725  2011-10-03 08:33  m_talker_Client beta0.4\bin\m_interface\Listener_send_msg.class

     文件       1049  2011-10-03 08:33  m_talker_Client beta0.4\bin\m_interface\Listener_ta_input_ip.class

     文件       1353  2011-10-03 08:33  m_talker_Client beta0.4\bin\m_interface\Listener_ta_local_ip.class

     文件        894  2011-10-03 08:33  m_talker_Client beta0.4\bin\m_interface\Listener_ta_m_friend.class

     文件        629  2011-09-27 09:26  m_talker_Client beta0.4\bin\m_main\.settings\org.eclipse.jdt.core.prefs

     文件        575  2011-10-03 08:33  m_talker_Client beta0.4\bin\m_main\MyTalkerClient.class

     文件        401  2011-10-03 08:33  m_talker_Client beta0.4\bin\m_UDP\Client_Broadcast_Receiver.class

     文件       1702  2011-10-03 08:33  m_talker_Client beta0.4\bin\m_UDP\Client_UDP_Receiver.class

     文件       3079  2011-10-02 23:19  m_talker_Client beta0.4\src\m_interface\ClientInterface.java

     文件        508  2011-10-02 22:53  m_talker_Client beta0.4\src\m_interface\Listener_send_ip.java

     文件        832  2011-10-02 21:03  m_talker_Client beta0.4\src\m_interface\Listener_send_msg.java

     文件        534  2011-10-02 23:08  m_talker_Client beta0.4\src\m_interface\Listener_ta_input_ip.java

     文件        605  2011-10-02 21:03  m_talker_Client beta0.4\src\m_interface\Listener_ta_local_ip.java

     文件        470  2011-10-02 23:14  m_talker_Client beta0.4\src\m_interface\Listener_ta_m_friend.java

     文件        629  2011-09-27 09:26  m_talker_Client beta0.4\src\m_main\.settings\org.eclipse.jdt.core.prefs

     文件        528  2011-10-02 21:03  m_talker_Client beta0.4\src\m_main\MyTalkerClient.java

     文件        120  2011-10-02 22:54  m_talker_Client beta0.4\src\m_UDP\Client_Broadcast_Receiver.java

     文件        929  2011-10-02 22:53  m_talker_Client beta0.4\src\m_UDP\Client_UDP_Receiver.java

     目录          0  2011-10-03 08:33  m_talker_Client beta0.4\bin\m_main\.settings

     目录          0  2011-10-03 08:33  m_talker_Client beta0.4\src\m_main\.settings

     目录          0  2011-10-03 08:33  m_talker_Client beta0.4\bin\m_interface

     目录          0  2011-10-03 08:33  m_talker_Client beta0.4\bin\m_main

     目录          0  2011-10-03 08:33  m_talker_Client beta0.4\bin\m_UDP

     目录          0  2011-10-03 08:33  m_talker_Client beta0.4\src\m_interface

     目录          0  2011-10-03 08:33  m_talker_Client beta0.4\src\m_main

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

评论

共有 条评论