|
|
|
@ -2,12 +2,17 @@ package com.example.jmacro.wjdr.tool;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import cn.hutool.log.StaticLog;
|
|
|
|
|
import com.example.jmacro.wjdr.util.DialogUtil;
|
|
|
|
|
import com.example.jmacro.wjdr.util.Logger;
|
|
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
import java.awt.event.*;
|
|
|
|
|
import java.awt.event.KeyAdapter;
|
|
|
|
|
import java.awt.event.KeyEvent;
|
|
|
|
|
import java.awt.event.MouseAdapter;
|
|
|
|
|
import java.awt.event.MouseEvent;
|
|
|
|
|
import java.awt.event.MouseMotionAdapter;
|
|
|
|
|
import java.awt.event.WindowAdapter;
|
|
|
|
|
import java.awt.event.WindowEvent;
|
|
|
|
|
import java.awt.image.BufferedImage;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -94,10 +99,13 @@ public class Location extends JFrame {
|
|
|
|
|
super.mouseReleased(e);
|
|
|
|
|
x = e.getX();
|
|
|
|
|
y = e.getY();
|
|
|
|
|
Logger.info("屏幕坐标:[{},{}]", x, y);
|
|
|
|
|
Logger.info("相对坐标:[{},{}]", x - originX, y - originY);
|
|
|
|
|
Logger.info("坐标采集:");
|
|
|
|
|
Logger.info("屏幕坐标:[{},{}],用法:new ViewPoint({},{},true)", x, y, x, y);
|
|
|
|
|
Logger.info("相对坐标:[{},{}],用法:new ViewPoint({},{})", x - originX, y - originY, x - originX, y - originY);
|
|
|
|
|
String hexColor = Integer.toHexString(capture.getRGB(x, y) & 0xFFFFFF);
|
|
|
|
|
Logger.info("坐标色值:[#{}]", hexColor);
|
|
|
|
|
close();
|
|
|
|
|
DialogUtil.confirm(StrUtil.format("屏幕坐标:[{},{}]\n相对坐标:[{},{}]", x, y, x - originX, y - originY));
|
|
|
|
|
JOptionPane.showConfirmDialog(null, StrUtil.format("屏幕坐标:[{},{}]\n相对坐标:[{},{}]\n坐标色值:[#{}]", x, y, x - originX, y - originY, hexColor), "坐标信息", 1);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -141,11 +149,13 @@ public class Location extends JFrame {
|
|
|
|
|
g2d.fillRect(0, 0, capture.getWidth(), capture.getHeight());
|
|
|
|
|
|
|
|
|
|
g2d.setColor(Color.WHITE);
|
|
|
|
|
g2d.fillRect(x + 5, y + 5, 120, 35);
|
|
|
|
|
g2d.fillRect(x + 5, y + 5, 120, 50);
|
|
|
|
|
|
|
|
|
|
g2d.setColor(Color.DARK_GRAY);
|
|
|
|
|
g2d.drawString(StrUtil.format("屏幕坐标[{},{}]", x, y), x + 10, y + 20);
|
|
|
|
|
g2d.drawString(StrUtil.format("相对坐标[{},{}]", x - originX, y - originY), x + 10, y + 35);
|
|
|
|
|
int rgb = capture.getRGB(x, y) & 0xFFFFFF;
|
|
|
|
|
g2d.drawString(StrUtil.format("坐标色值[#{}]", Integer.toHexString(rgb)), x + 10, y + 50);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void close() {
|
|
|
|
|