91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 23KB
    文件類型: .java
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-22
  • 語言: Java
  • 標簽: 截圖??平臺集成??

資源簡介

java實現截圖功能,類似QQ截圖,直接導入就可以使用,

資源截圖

代碼片段和文件信息

/**
?*?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(“作者:?gaowei“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.EXIT_ON_CLOSE);
????}
????
????private?void?updates(){
????????this.setVisible(true);
????????if(get!=null){
????????????//如果索引是0則表示一張圖片都沒有被加入過
????????????//則要清除當前的東西重新把tabpane放進來
????????????if(index==0){
????????????????c.removeAll();
????????????????c.add(jtpBorderLayout.CENTER);
????????????}else{//否則的話直接對tabpane添加面板就可以了
????????????????//就什么都不用做了
????????????}

評論

共有 條評論