diff --git a/src/main/java/com/example/jmacro/wjdr/JMainApplication.java b/src/main/java/com/example/jmacro/wjdr/JMainApplication.java index b219c63..ab7cddd 100644 --- a/src/main/java/com/example/jmacro/wjdr/JMainApplication.java +++ b/src/main/java/com/example/jmacro/wjdr/JMainApplication.java @@ -1,5 +1,7 @@ package com.example.jmacro.wjdr; +import com.example.jmacro.wjdr.base.ViewPoint; +import com.example.jmacro.wjdr.base.ViewRect; import com.example.jmacro.wjdr.wjdr.MacroForWJDR; import com.example.jmacro.wjdr.ui.FXMLUtil; import com.example.jmacro.wjdr.util.Logger; @@ -66,7 +68,17 @@ public class JMainApplication extends Application { }); // 服务初始化 - JMainService.init(new MacroForWJDR(), new File("legend")); + JMainService.init(new JMacro() { + @Override + public ViewRect focus() { + return new ViewRect(0,0,500,500); + } + + @Override + public void run() { + + } + }, new File("legend")); } public static void main(String[] args) { diff --git a/src/main/java/com/example/jmacro/wjdr/tool/Location.java b/src/main/java/com/example/jmacro/wjdr/tool/Location.java index ff52188..cbc421a 100644 --- a/src/main/java/com/example/jmacro/wjdr/tool/Location.java +++ b/src/main/java/com/example/jmacro/wjdr/tool/Location.java @@ -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() {