JAVA实现延时鼠标操作

该博客介绍了一个JAVA程序,使用Robot类模拟鼠标操作,实现延时点击功能。程序设计用于在指定区域自动执行点击事件,如在夜间自动控制下载任务。注意,delay方法的最大延时为60秒,因此采用了Timer计时器。虽然代码可读性不高,但可以直接运行使用。
摘要由CSDN通过智能技术生成

这里写图片描述

package com.black;

import java.awt.AWTException;

public class dingshidianji extends JFrame {
private ButtonGroup bg;
private JPanel contentPane;
private JTextField textField;
private JTextField textField_1;
private JTextField textField_2;
private String fangshi = “InputEvent.BUTTON1_MASK”;// 默认方式
private int shijian = 0;
public int x_move = 0, y_move = 0;
static JLabel lblNewLabel_1;
private static String str;
private JLabel label_2;

/**
 * Launch the application.
 *
 * @throws AWTException
 */
public static void main(String[] args) throws AWTException {

    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                dingshidianji frame = new dingshidianji();
                frame.setVisible(true);

                UIManager.setLookAndFeel(new SubstanceLookAndFeel());
                JFrame.setDefaultLookAndFeelDecorated(true);
                JDialog.setDefaultLookAndFeelDecorated(true);
                SubstanceLookAndFeel.setCurrentTheme(new SubstanceTerracottaTheme());
                SubstanceLookAndFeel.setSkin(new EmeraldDuskSkin()); 
                SubstanceLookAndFeel.setCurrentButtonShaper(new ClassicButtonShaper()); 
                SubstanceLookAndFeel.setCurrentWatermark(new SubstanceBubblesWatermark()); 
                SubstanceLookAndFeel.setCurrentBorderPainter(new StandardBorderPainter()); 
                SubstanceLookAndFeel.setCurrentGradientPainter(new StandardGradientPainter()); 
                SubstanceLookAndFeel.setCurrentTitlePainter(new FlatTitlePainter());
          
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值