• 大小: 2.09MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-25
  • 语言: 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.6\bin\
     目录           0  2011-01-06 20:26  testmychatroom1.6\bin\chat\
     文件       39801  2009-07-13 09:02  testmychatroom1.6\bin\chat\1.gif
     文件        1254  2009-04-16 21:18  testmychatroom1.6\bin\chat\2.gif
     文件        8000  2008-11-22 00:37  testmychatroom1.6\bin\chat\ButtonSenddown.gif
     文件        1393  2011-01-06 20:26  testmychatroom1.6\bin\chat\CaptureScreen$1.class
     文件         506  2011-01-06 20:26  testmychatroom1.6\bin\chat\CaptureScreen$2.class
     文件         938  2011-01-06 20:26  testmychatroom1.6\bin\chat\CaptureScreen$BMPfilter.class
     文件         938  2011-01-06 20:26  testmychatroom1.6\bin\chat\CaptureScreen$GIFfilter.class
     文件         938  2011-01-06 20:26  testmychatroom1.6\bin\chat\CaptureScreen$JPGfilter.class
     文件        2272  2011-01-06 20:26  testmychatroom1.6\bin\chat\CaptureScreen$PicPanel.class
     文件        1052  2011-01-06 20:26  testmychatroom1.6\bin\chat\CaptureScreen$PNGfilter.class
     文件        8289  2011-01-06 20:26  testmychatroom1.6\bin\chat\CaptureScreen$Temp.class
     文件        9332  2011-01-06 20:26  testmychatroom1.6\bin\chat\CaptureScreen.class
     文件         651  2011-01-06 20:28  testmychatroom1.6\bin\chat\Chatframe$1.class
     文件        3837  2011-01-06 20:28  testmychatroom1.6\bin\chat\Chatframe$acceptfilethread.class
     文件        2922  2011-01-06 20:28  testmychatroom1.6\bin\chat\Chatframe$FontAttrib.class
     文件        4114  2011-01-06 20:28  testmychatroom1.6\bin\chat\Chatframe$sendfilethread.class
     文件       19390  2011-01-06 20:28  testmychatroom1.6\bin\chat\Chatframe.class
     文件         596  2011-01-06 20:28  testmychatroom1.6\bin\chat\Connect$1.class
     文件        7497  2011-01-06 20:28  testmychatroom1.6\bin\chat\Connect.class
     文件        9220  1998-05-02 04:01  testmychatroom1.6\bin\chat\msg.wav
     文件        2611  2011-01-06 20:26  testmychatroom1.6\bin\chat\MyTextArea.class
     文件        4023  2011-01-06 20:26  testmychatroom1.6\bin\chat\PList.class
     文件        1033  2011-01-06 20:26  testmychatroom1.6\bin\chat\PopupListener.class
     文件        1692  2011-01-06 20:26  testmychatroom1.6\bin\chat\States.class
     目录           0  2011-01-06 20:26  testmychatroom1.6\bin\server\
     文件        3315  2011-01-06 20:26  testmychatroom1.6\bin\server\ChatServer.class
............此处省略594个文件信息

评论

共有 条评论