資源簡(jiǎn)介
基于JAVA的聊天室+本地IP及端口登錄+公聊+私聊+相互傳送文件+界面字體風(fēng)格設(shè)置+截圖保存在本地功能

代碼片段和文件信息
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;//一個(gè)放置很多份圖片
????private?int?index;//一個(gè)一直會(huì)遞增的索引用于標(biāo)認(rèn)圖片
????private?JRadioButton?javasystem;//JAVA界面系統(tǒng)界面
????/**?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(“提示:雙擊選定區(qū)域進(jìn)行保存等操作“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(“公共操作區(qū)“));
????????JPanel?jp=new?JPanel();//放置兩個(gè)單選按鈕的面板
????????jp.add(java=new?JRadioButton(“java界面“));
????????jp.add(system=new?JRadioButton(“系統(tǒng)界面“true));
????????java.addActionListener(this);
????????system.addActionListener(this);
????????jp.setBorder(BorderFactory.createtitledBorder(“界面風(fēng)格“));
????????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則表示一張圖片都沒有被加入過
????????????//則要清除當(dāng)前的東西重新把tabpane放進(jìn)來(lái)
????????????if(index==0){
????????????????c.removeAll();
????????????????c.add(jtpBorderLayout.CENTER);
????????????}else{//否則的話直接對(duì)tabpane添加面板就可以了
????????????????
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????232??2009-07-12?14:02??mychatroom\.classpath
?????文件????????393??2009-07-12?14:02??mychatroom\.project
?????文件??????39801??2009-07-13?09:02??mychatroom\bin\chat\1.gif
?????文件???????1254??2009-04-16?21:18??mychatroom\bin\chat\2.gif
?????文件???????8000??2008-11-22?00:37??mychatroom\bin\chat\ButtonSenddown.gif
?????文件???????1393??2018-06-30?13:28??mychatroom\bin\chat\CaptureScreen$1.class
?????文件????????506??2018-06-30?13:28??mychatroom\bin\chat\CaptureScreen$2.class
?????文件????????938??2018-06-30?13:28??mychatroom\bin\chat\CaptureScreen$BMPfilter.class
?????文件????????938??2018-06-30?13:28??mychatroom\bin\chat\CaptureScreen$GIFfilter.class
?????文件????????938??2018-06-30?13:28??mychatroom\bin\chat\CaptureScreen$JPGfilter.class
?????文件???????2276??2018-06-30?13:28??mychatroom\bin\chat\CaptureScreen$PicPanel.class
?????文件???????1052??2018-06-30?13:28??mychatroom\bin\chat\CaptureScreen$PNGfilter.class
?????文件???????8318??2018-06-30?13:28??mychatroom\bin\chat\CaptureScreen$Temp.class
?????文件???????9315??2018-06-30?13:28??mychatroom\bin\chat\CaptureScreen.class
?????文件????????651??2018-06-30?13:28??mychatroom\bin\chat\Chatfr
?????文件???????3845??2018-06-30?13:28??mychatroom\bin\chat\Chatfr
?????文件???????2926??2018-06-30?13:28??mychatroom\bin\chat\Chatfr
?????文件???????4121??2018-06-30?13:28??mychatroom\bin\chat\Chatfr
?????文件??????19433??2018-06-30?13:28??mychatroom\bin\chat\Chatfr
?????文件????????596??2018-06-30?13:28??mychatroom\bin\chat\Connect$1.class
?????文件???????7498??2018-06-30?13:28??mychatroom\bin\chat\Connect.class
?????文件???????9220??1998-05-02?04:01??mychatroom\bin\chat\msg.wav
?????文件???????2614??2018-07-08?15:10??mychatroom\bin\chat\MyTextArea.class
?????文件???????4007??2018-06-30?13:28??mychatroom\bin\chat\PList.class
?????文件???????1033??2018-06-30?13:28??mychatroom\bin\chat\PopupListener.class
?????文件???????1692??2018-06-30?13:28??mychatroom\bin\chat\States.class
?????文件???????3310??2018-06-30?13:28??mychatroom\bin\server\ChatServer.class
?????文件???????4173??2018-06-30?13:28??mychatroom\bin\server\ClientProc.class
?????文件??????11708??2002-09-11?12:18??mychatroom\bin\sound\call.wav
?????文件???????9156??1998-05-02?04:01??mychatroom\bin\sound\folder.wav
............此處省略598個(gè)文件信息
評(píng)論
共有 條評(píng)論