이 기사의 예는 Java 시뮬레이션 QQ 데스크탑 스크린 샷의 구현 방법을 설명합니다. 참조를 위해 모든 사람을 위해 공유하십시오. 세부 사항은 다음과 같습니다.
QQ의 데스크탑 스크린 샷 기능은 작년에 매우 편리합니다.
이 방법은 먼저 화면의 전체 이미지를 포착하고 JFrame에 이미지를 표시 한 다음 JFRAME의 전체 화면을 표시하면 마우스의 작업 영역을 얻을 수 있습니다. 데스크탑 화면 스크린 샷의 데스크탑에서 작은 것을 달성합니다.
Javax.ava.Action.ActionEvent를 가져옵니다. MouseMotionListener;/***는 QQ 데스크탑 스크린 샷 기능을 시뮬레이션하기 위해 Java를 사용합니다. button = new Jbutton ( "시뮬레이션 화면 (오른쪽 -클릭 종료)"); Button.AddActionListener (New ActionListener () {public void ActionPerformed (ActionEvent e) {try {new Screenwindow (imglabel); {예외적 인 E1) {JobPane .ShowConfirmDialog (null, "우발적 오류!", "시스템 프롬프트", jobPane.Default_opting, jobpane.error_message); jscrollpane = this ; Boolean isdrag = private int xed = 0; (New ImageIcon (ScreenImage.getScreenImage (0, 0, Screendims.width, Screendims.height)); label .setCursor (new Cursor (cursor.crosshair_cursor)); label.addmouselistener (New MouseAdapter () {public void mouseclick (Mouseevent e ) {if) button () == mouseeevent.button3) {dispose ();}} public void mousepressed (mouseeevent e) {x = e.getx (); e) {xend = e.gety (e.gety); ) {int temp = y; ynd = temp; jobpane.showconfirmdialog (null, "우연한 오류! ","시스템 팁 ", jobpane.default_opting, jobpane.error_message);} dispose ();}}); label.addmouseMotionListener (new MouseMotionListener () {public void MousEdragaged (mouseeevent e) {if (! isdrag) isdrag = true ; screensize (screendims.width, screendims.height). Robot = New Robot (); addimage (화면, 1); Waitforid (0);
이 기사는 모든 사람의 Java 프로그램 설계에 도움이되기를 바랍니다.