Java Call EXE screenshot program implementation delay screenshot

Source: Internet
Author: User
Tags apple keyboard

Before using the Apple keyboard, there was no quick fullscreen tool on the Windows system, and there was no way to intercept the drop-down menu and click on other places to disappear.

Do not want to write so complex, use Java write a simple call EXE program to achieve delay

1 Importjavax.swing.*;2 Importjava.awt.event.ActionEvent;3 ImportJava.awt.event.ActionListener;4 5 /**6 * Created by YCL on 2017/8/17 2017-8-17 22:33:59.7  */8  Public classCutscreenextendsJFrameImplementsActionListener {9 Ten  One JPanel JP; A JLabel jltime; - JComboBox jcbtime; - JButton jbtime; the  -      PublicCutscreen () { -JP =NewJPanel (); -          This. Setcontentpane (JP); +          This. Settitle ("Delay"); -          This. setvisible (true); +Jp.setlayout (NULL); AJltime =NewJLabel ("Delay Time:"); atJltime.setbounds (25, 15, 100, 30); - Jp.add (jltime); -  -string[] str =Newstring[]{"1", "2", "3", "5", "10"}; -Jcbtime =NewJComboBox (str); -Jcbtime.setbounds (110, 15, 100, 30); in Jp.add (jcbtime); -Jbtime =NewJButton ("Start"); toJbtime.addactionlistener ( This); +Jbtime.setbounds (220, 15, 70, 30); - Jp.add (jbtime); the  *          This. Setdefaultcloseoperation (jframe.exit_on_close); $          This. SetBounds (600, 300, 325, 100);Panax Notoginseng     } -  the @Override +      Public voidactionperformed (ActionEvent e) { A         if(E.getsource () = =jbtime) { theString time =Jcbtime.getselecteditem (). toString (); +             Try { -                  This. Setextendedstate (jframe.iconified);//minimized after clicking on the window $Thread.Sleep (Integer.parseint (time) * 1000); $ Openexe (); -System.exit (0);//quit main program after starting EXE program -}Catch(interruptedexception E1) { the e1.printstacktrace (); -             }Wuyi         } the     } -  Wu     //Execute EXE program, also copy on-line -      Public Static voidOpenexe () { About         FinalRuntime runtime =runtime.getruntime (); $Process Process =NULL; -  -         Try { -Process = Runtime.exec ("D:\\software\\tengxunjt.exe"); A  +}Catch(FinalException e) { theSystem.out.println ("Error exec!"); -         } $     } the  the      Public Static voidMain (string[] args) { the         NewCutscreen (); the     } -}

>>>:

Java calls EXE program implementation delay

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.