java聊天程序群聊,私聊,传输文件,截图等功能


群聊,私聊,传输文件,截图,改变字体等功能
资源截图
代码片段和文件信息
package chat;

/**
 * CaptureScreen.java
 */
import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import javax.imageio.*;
import java.awt.image.*;

public class CaptureScreen extends Jframe implements ActionListener {
    private JButton startcancel;
    private JPanel c;
    private BufferedImage get;
    private JTabbedPane jtp;//一个放置很多份图片
    private int index;//一个一直会递增的索引用于标认图片
    private JRadioButton javasystem;//JAVA界面系统界面
    /** Creates a new instance of CaptureScreen */
    public CaptureScreen() {
        super(“屏幕截取“);
        try{
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        }catch(Exception exe){
            exe.printStackTrace();
        }
        initWindow();
        initOther();
    }
    private void initOther(){
        jtp=new JTabbedPane(JTabbedPane.TOPJTabbedPane.SCROLL_TAB_LAYOUT);
    }
    private void initWindow(){
        start=new JButton(“开始截取“);
        cancel=new JButton(“退出“);
        start.addActionListener(this);
        cancel.addActionListener(this);
        JPanel buttonJP=new JPanel();
        c=new JPanel(new BorderLayout());
        JLabel jl=new JLabel(“屏幕截取“ JLabel.CENTER);
        JLabel jl1=new JLabel(“提示:双击选定区域进行保存等操作“JLabel.CENTER);
        jl.setFont(new Font(“黑体“Font.BOLD40));
        jl1.setFont(new Font(“宋体“Font.BOLD20));
        jl.setForeground(Color.RED);
        jl1.setForeground(Color.BLUE);
        c.add(jlBorderLayout.CENTER);
        c.add(jl1BorderLayout.SOUTH);
        buttonJP.add(start);
        buttonJP.add(cancel);
        buttonJP.setBorder(BorderFactory.createtitledBorder(“公共操作区“));
        JPanel jp=new JPanel();//放置两个单选按钮的面板
        jp.add(java=new JRadioButton(“java界面“));
        jp.add(system=new JRadioButton(“系统界面“true));
        java.addActionListener(this);
        system.addActionListener(this);
        jp.setBorder(BorderFactory.createtitledBorder(“界面风格“));
        ButtonGroup bg=new ButtonGroup();
        bg.add(java);
        bg.add(system);
        JPanel all=new JPanel();
        all.add(jp);
        all.add(buttonJP);
        this.getContentPane().add(cBorderLayout.CENTER);
        this.getContentPane().add(allBorderLayout.SOUTH);
        this.setSize(500400);
        this.setLocationRelativeTo(null);
        this.setVisible(true);
        this.setAlwaysOnTop(true);
        this.setDefaultCloseOperation(Jframe.DISPOSE_ON_CLOSE);
    }
    
    private void updates(){
        this.setVisible(true);
        if(get!=null){
            //如果索引是0则表示一张图片都没有被加入过
            //则要清除当前的东西重新把tabpane放进来
            if(index==0){
                c.removeAll();
                c.add(jtpBorderLayout.CENTER);
            }else{//否则的话直接对tabpane添加面板就可以了
                

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2009-07-14 15:07  testmychatroom1.6
     文件         232  2009-07-12 14:02  testmychatroom1.6.classpath
     文件         393  2009-07-12 14:02  testmychatroom1.6.project
     目录           0  2011-01-06 20:26  testmychatroom1.6in
     目录           0  2011-01-06 20:26  testmychatroom1.6inchat
     文件       39801  2009-07-13 09:02  testmychatroom1.6inchat1.gif
     文件        1254  2009-04-16 21:18  testmychatroom1.6inchat2.gif
     文件        8000  2008-11-22 00:37  testmychatroom1.6inchatButtonSenddown.gif
     文件        1393  2011-01-06 20:26  testmychatroom1.6inchatCaptureScreen$1.class
     文件         506  2011-01-06 20:26  testmychatroom1.6inchatCaptureScreen$2.class
     文件         938  2011-01-06 20:26  testmychatroom1.6inchatCaptureScreen$BMPfilter.class
     文件         938  2011-01-06 20:26  testmychatroom1.6inchatCaptureScreen$GIFfilter.class
     文件         938  2011-01-06 20:26  testmychatroom1.6inchatCaptureScreen$JPGfilter.class
     文件        2272  2011-01-06 20:26  testmychatroom1.6inchatCaptureScreen$PicPanel.class
     文件        1052  2011-01-06 20:26  testmychatroom1.6inchatCaptureScreen$PNGfilter.class
     文件        8289  2011-01-06 20:26  testmychatroom1.6inchatCaptureScreen$Temp.class
     文件        9332  2011-01-06 20:26  testmychatroom1.6inchatCaptureScreen.class
     文件         651  2011-01-06 20:28  testmychatroom1.6inchatChatframe$1.class
     文件        3837  2011-01-06 20:28  testmychatroom1.6inchatChatframe$acceptfilethread.class
     文件        2922  2011-01-06 20:28  testmychatroom1.6inchatChatframe$FontAttrib.class
     文件        4114  2011-01-06 20:28  testmychatroom1.6inchatChatframe$sendfilethread.class
     文件       19390  2011-01-06 20:28  testmychatroom1.6inchatChatframe.class
     文件         596  2011-01-06 20:28  testmychatroom1.6inchatConnect$1.class
     文件        7497  2011-01-06 20:28  testmychatroom1.6inchatConnect.class
     文件        9220  1998-05-02 04:01  testmychatroom1.6inchatmsg.wav
     文件        2611  2011-01-06 20:26  testmychatroom1.6inchatMyTextArea.class
     文件        4023  2011-01-06 20:26  testmychatroom1.6inchatPList.class
     文件        1033  2011-01-06 20:26  testmychatroom1.6inchatPopupListener.class
     文件        1692  2011-01-06 20:26  testmychatroom1.6inchatStates.class
     目录           0  2011-01-06 20:26  testmychatroom1.6inserver
     文件        3315  2011-01-06 20:26  testmychatroom1.6inserverChatServer.class
............此处省略594个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)