Turn off the IE window with Java

xiaoxiao2021-03-06  15

The code is briefly description: a maximized IE window can be turned off at 1024 * 768 screen resolution. Import java.awt. *; import java.awt.event. *;

. / ** this class will close an 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.mouseelelease (InputEvent.Button1_mask);} // end main

} // End Class Robot04 This program's GUI version. Robot04gui.java/** * robot04gui.java * create by kin. 2004/11/07. * Promport 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);}}

转载请注明原文地址:https://www.9cbs.com/read-46111.html

New Post(0)