Use Java to close IE windows

Source: Internet
Author: User
Tags window
Java)


code Simple Description: You can turn off a maximized IE window at 1024*768 screen resolution.








import java.awt.*;


import java.awt.event.*;





/**this class would close a maxmimum IE window in the 1024*768 ' s screen resolution ' s machine.*/


public class robot04{


public static void Main (string[] args)


throws awtexception{


Robot Robot = new Robot ();


Robot.mousemove (1005,10);


Robot.delay (2000);


robot.mousepress (Inputevent.button1_mask);


Robot.delay (2000);


robot.mouserelease (Inputevent.button1_mask);


}//end Main





}//end class Robot04





the GUI version of this program.


Robot04gui.java


/**


* Robot04gui.java


* Create by Kin. 2004/11/07.


* Please enjoy this.


*/


Import javax.swing.*;


import javax.swing.event.*;





import java.awt.event.*;


import java.awt.*;





/**robot04 ' s GUI version.*/


public class Robot04gui extends JFrame {





private JButton B = new JButton ("Close IE");





public Robot04gui () {


super ("Close IE");


Getcontentpane (). Add (B,borderlayout.center);


B.addactionlistener (New ActionListener () {


public void actionperformed (ActionEvent e) {


try {


new Robot04 (). Main (New string[]{});


} catch (Exception ex) {


Ex.printstacktrace ();


}


}


});


}





public static void Main (string[] args) {


Robot04gui r = new Robot04gui ();


r.setsize (200,200);


R.setvisible (TRUE);


}


}














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.