国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > Java > 正文

java實現(xiàn)人工智能化屏幕監(jiān)控窗口

2024-07-14 08:42:25
字體:
供稿:網(wǎng)友

本文實例為大家分享了java實現(xiàn)人工智能化屏幕監(jiān)控窗口的具體代碼,供大家參考,具體內(nèi)容如下

具體代碼實現(xiàn)(含注釋)

public class Main{  public static void main(String[] args) throws Exception{    /* test code */  }  /**  *用于實時監(jiān)控屏幕的窗口  *@author chengxi  *@param void   *@return void   */  public static void mvcontroll() throws Exception{    /* 建立一個監(jiān)控屏幕的窗口 */    JFrame frame = new JFrame("人工智能化屏幕監(jiān)控系統(tǒng)") ;    frame.setSize(600,600) ;    frame.setVisible(true) ;    /* 設(shè)置總是顯示在頂部 */    frame.setAlwaysOnTop(true) ;    /* 獲取默認的工具包 */    Toolkit tk = Toolkit.getDefaultToolkit() ;    /* 使用工具包獲取屏幕的大小,這是創(chuàng)建工具包的唯一作用 */    Dimension dm = tk.getScreenSize() ;    /* 創(chuàng)建圖像的顯示區(qū)域 */    JLabel imageLabel = new JLabel() ;    frame.add(imageLabel) ;    /* 創(chuàng)建一個機器人 */    Robot robot = new Robot() ;    /* 持續(xù)監(jiān)控屏幕 */    while(true) {      /* 創(chuàng)建用于顯示屏幕分享部分的區(qū)域,填入x/y/width/height      Rectangle rec = new Rectangle(frame.getWidth() , 0 , (int)dm.getWidth() - frame.getWidth() , (int)dm.getHeight()) ;      /* 根據(jù)屏幕分享的當(dāng)前分享圖像創(chuàng)建一個圖像對象 */      BufferedImage bufimg = robot.createScreenCapture(rec)) ;      /* 實時顯示在圖像顯示區(qū)域中 */      imageLabel.setIcon(new ImageIcon(bufimg)) ;    }  }  /**  *打開指定的路徑  public static void midopenQQ(String path) throws Exception{    Desktop desktop = Desktop.getDesktop() ;    /* 打開指定的uri所指定的應(yīng)用程序 */    desktop.open(new File(path)) ;    /* 創(chuàng)建一個機器人 */    Robot robot = new Robot() ;    /* 因為創(chuàng)建機器人需要時間,因此在后續(xù)操作之前需要進行延遲加載 */    robot.delay(2000) ;    /* 使用robot的mouseMove方法將鼠標的光標移動到指定的位置上,這里我設(shè)置的是QQ界面的登錄按鈕上面 */    robot.mouseMove(709,519) ;    /* 定義鼠標事件:按下 */    robot.mousePress(InputEvent.BUTTON1_DOWN_MASK) ;    /* 定義鼠標事件:放開 */    robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK) ;    /* 事件的延遲 */    robot.delay(300) ;  }  /**  *簡單的打開path指定的路徑所在的應(yīng)用程序  *@author chengxi  *@param String path  *@return void  */  public static void easyopenQQ(String path) throws Exception{    Desktop desktop = Desktop.getDesktop() ;    /* 打開指定的文件 */    desktop.open(new File(path)) ;  }  /**  *打開uri指定的網(wǎng)址  *@author chengxi  *@param String uri  *@return void  */  public static void openBrowse(String uri) throws Exception{    /* 允許java程序使用在桌面上注冊了的所有應(yīng)用程序 */    Desktop desktop = Desktop.getDesktop() ;    /* 使用默認的瀏覽器打開指定uri */    desktop.browse(new URI("http://m.survivalescaperooms.com")) ;  }

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持VeVb武林網(wǎng)。


注:相關(guān)教程知識閱讀請移步到JAVA教程頻道。
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 临城县| 庆云县| 屯昌县| 壶关县| 桐庐县| 天气| 甘孜| 江油市| 庆阳市| 曲阳县| 商河县| 仪陇县| 碌曲县| 中牟县| 南皮县| 北辰区| 炎陵县| 兰考县| 淮阳县| 古交市| 博兴县| 蒙自县| 中超| 平泉县| 金门县| 定日县| 镇坪县| 图们市| 九龙城区| 深水埗区| 昂仁县| 瑞昌市| 南阳市| 山东| 含山县| 怀来县| 金坛市| 沈阳市| 永安市| 东海县| 柯坪县|