From b236627958a9d6012a5cafc84d90cff03671f6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=B7=E5=B8=88=E5=82=85?= Date: Tue, 29 Oct 2024 16:42:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=8E=8B=E7=BC=A9=E5=B0=8F?= =?UTF-8?q?=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ImageCompressTool/README.md" | 10 + .../ImageCompressTool/_ic_" | 0 .../ImageCompressTool/config.config" | 5 + .../ImageCompressTool/ic.ico" | Bin 0 -> 4286 bytes .../ImageCompressTool/pom.xml" | 85 ++++ .../src/main/java/module-info.java" | 14 + .../criver/imagecompresstool/ICTmain.java" | 10 + .../application/appMaster.java" | 45 ++ .../application/appPop.java" | 109 +++++ .../contorller/conMaster.java" | 405 ++++++++++++++++++ .../imagecompresstool/data/daConfig.java" | 70 +++ .../imagecompresstool/data/daFxml.java" | 10 + .../imagecompresstool/data/daMaterial.java" | 10 + .../imagecompresstool/data/daValue.java" | 56 +++ .../imagecompresstool/function/funCache.java" | 23 + .../imagecompresstool/function/funIcon.java" | 71 +++ .../imagecompresstool/function/funLock.java" | 36 ++ .../imagecompresstool/function/funReg.java" | 109 +++++ .../imagecompresstool/function/funSize.java" | 29 ++ .../imagecompresstool/function/funThumb.java" | 65 +++ .../imagecompresstool/function/funTray.java" | 123 ++++++ .../imagecompresstool/modular/moRow.java" | 102 +++++ .../imagecompresstool/css/context_menu.css" | 17 + .../criver/imagecompresstool/css/master.css" | 84 ++++ .../imagecompresstool/fxml/master.fxml" | 63 +++ .../criver/imagecompresstool/fxml/pop.fxml" | 42 ++ .../criver/imagecompresstool/material/ic.ico" | Bin 0 -> 4286 bytes .../imagecompresstool/material/ico_32x32.png" | Bin 0 -> 233 bytes 28 files changed, 1593 insertions(+) create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/README.md" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/_ic_" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/config.config" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/ic.ico" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/pom.xml" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/module-info.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/ICTmain.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/application/appMaster.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/application/appPop.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/contorller/conMaster.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daConfig.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daFxml.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daMaterial.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daValue.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funCache.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funIcon.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funLock.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funReg.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funSize.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funThumb.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funTray.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/modular/moRow.java" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/css/context_menu.css" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/css/master.css" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/fxml/master.fxml" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/fxml/pop.fxml" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/material/ic.ico" create mode 100644 "\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/material/ico_32x32.png" diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/README.md" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/README.md" new file mode 100644 index 0000000..e57a63a --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/README.md" @@ -0,0 +1,10 @@ +# 介绍 +由于工作需要,经常在线上找网站对图片压缩,比较麻烦。乘着摸鱼时间,就自己做了个图片压缩的工具,直接在文件管理器中右键图片就可以了,简单方便,就有更多时间摸鱼了。 +CSDN: https://blog.csdn.net/weixin_44167999/article/details/137079465 +gitee: https://gitee.com/criver_world/image-compress-tool +# 环境 +jdk21+ +# 使用方式 +运行程序后,就可以在文件管理器中右键图片压缩了。 +支持三档位压缩强度 +额外增加了转icon的功能 \ No newline at end of file diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/_ic_" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/_ic_" new file mode 100644 index 0000000..e69de29 diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/config.config" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/config.config" new file mode 100644 index 0000000..aa57f74 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/config.config" @@ -0,0 +1,5 @@ +bootstrap=false +content_menu=true +show_master=true +mode_compress=compress1 +mode_ico=ico5 \ No newline at end of file diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/ic.ico" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/ic.ico" new file mode 100644 index 0000000000000000000000000000000000000000..b0444c78870a713bdcbfbb46bd246a6dda1bb392 GIT binary patch literal 4286 zcmd6r&r4fD5XZOR$%6I=h{yEiS=yq9f@eWnq0&D=EBZHh=s)906fZ3ry-5!}^eU(k zf>k_L3$Y;Md^S$9eZH5DkmUKoxVy98o$u_-nzxe>p6I7i3H%Lf&q5dpA&jZ0Dom-M zkB`p1eA<+zB7_&4ACLi+S1RvSj#Z>bf^9h9g44L)Y5%LrkxE0QSNzz911>mi-;8_3 zS!5SZi#a~YbCuzZSsB`xDHP_xW&JH$TZGs3a9X|_tRLO_DC64;GO@cX6V)71J@epF z9}3qN;O~4V7p=2~pVP)V0{zg}586T?N_7DH))_jZw_UHCj zW$)r=#8~XWqhk(CUhXUg?Hn%38^wP5{zdn57WruzqaWX1jJ)t$%-N&yfU&bf-~0k& zzNfh}e%dsiuXjGn!S8zHr)8YR5Pr@nIp$%n@PT0t$>t@^UCNv7N85V-i6aj!dqQtm z4<FP*!^jhfl4f literal 0 HcmV?d00001 diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/pom.xml" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/pom.xml" new file mode 100644 index 0000000..9e36fd6 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/pom.xml" @@ -0,0 +1,85 @@ + + + 4.0.0 + + world.criver + ImageCompressTool + 1.0-SNAPSHOT + ImageCompressTool + + + UTF-8 + 5.9.2 + + + + + org.openjfx + javafx-controls + 21 + + + org.openjfx + javafx-fxml + 21 + + + org.openjfx + javafx-swing + 21 + + + net.coobird + thumbnailator + 0.4.20 + + + com.monchstudio.image + pngquant-png + 1.0.0 + + + org.apache.commons + commons-imaging + 1.0.0-alpha5 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + 21 + 21 + --enable-preview + + + + org.openjfx + javafx-maven-plugin + 0.0.8 + + + + default-cli + + world.criver.imagecompresstool/world.criver.imagecompresstool.ICTmain + + app + app + app + true + true + true + + + + + + + \ No newline at end of file diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/module-info.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/module-info.java" new file mode 100644 index 0000000..63073c5 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/module-info.java" @@ -0,0 +1,14 @@ +module world.criver.imagecompresstool { + requires javafx.controls; + requires javafx.fxml; + requires net.coobird.thumbnailator; + requires pngquant.png; + requires java.desktop; + requires org.apache.commons.imaging; + + opens world.criver.imagecompresstool.application to javafx.fxml,javafx.controls; + opens world.criver.imagecompresstool.data; + exports world.criver.imagecompresstool.contorller; + exports world.criver.imagecompresstool.application; + exports world.criver.imagecompresstool.modular; +} \ No newline at end of file diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/ICTmain.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/ICTmain.java" new file mode 100644 index 0000000..71c0e71 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/ICTmain.java" @@ -0,0 +1,10 @@ +package world.criver.imagecompresstool; + +import world.criver.imagecompresstool.application.appMaster; + +public class ICTmain { + + public static void main(String[] args) { + appMaster._main(args); + } +} \ No newline at end of file diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/application/appMaster.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/application/appMaster.java" new file mode 100644 index 0000000..b6d8d47 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/application/appMaster.java" @@ -0,0 +1,45 @@ +package world.criver.imagecompresstool.application; + +import javafx.application.Application; +import javafx.event.Event; +import javafx.scene.Scene; +import javafx.stage.Stage; +import javafx.stage.StageStyle; +import world.criver.imagecompresstool.data.daConfig; +import world.criver.imagecompresstool.data.daFxml; +import world.criver.imagecompresstool.data.daMaterial; +import world.criver.imagecompresstool.data.daValue; +import world.criver.imagecompresstool.function.funLock; +import world.criver.imagecompresstool.function.funReg; +import world.criver.imagecompresstool.function.funTray; + +public class appMaster extends Application { + public appMaster(){ + daValue.iniBinUrl(); + funLock lock=new funLock(); + lock.clip(daValue.commands); + if(lock.exist())System.exit(0); + daConfig.load(); + new funReg().change(); + funTray tray=new funTray(); + tray.keepAlive(); + tray.iniPopMenu(); + tray.iniTray(); + } + @Override + public void start(Stage stage) throws Exception { + Scene sc= new Scene(daFxml.master.load()); + sc.setFill(null); + stage.setScene(sc); + stage.setTitle("图片压缩工具:v1.1.1 SolitaryWayfarer"); + stage.getIcons().add(daMaterial.icon_32x32); + stage.initStyle(StageStyle.TRANSPARENT); + if(daConfig.show_master)stage.show(); + daValue.master=stage; + stage.setOnCloseRequest(Event::consume); + } + public static void _main(String[] args){ + daValue.commands=args; + launch(); + } +} diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/application/appPop.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/application/appPop.java" new file mode 100644 index 0000000..5dc839b --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/application/appPop.java" @@ -0,0 +1,109 @@ +package world.criver.imagecompresstool.application; + +import javafx.application.Application; +import javafx.application.Platform; +import javafx.fxml.FXMLLoader; +import javafx.scene.Scene; +import javafx.scene.control.Label; +import javafx.scene.paint.Color; +import javafx.stage.Screen; +import javafx.stage.Stage; +import javafx.stage.StageStyle; +import world.criver.imagecompresstool.data.daValue; +import world.criver.imagecompresstool.function.funIcon; +import world.criver.imagecompresstool.function.funSize; +import world.criver.imagecompresstool.function.funThumb; + +import java.util.Date; +import java.util.Timer; +import java.util.TimerTask; + +public class appPop extends Application { + + private String[] result=null; + private String mode; + private long id; + private double windows_w,windows_h; + private int show_time=50*3; + public appPop(long id,String mode,String[] result){ + this.result=result; + this.id=id; + this.mode=mode; + } + @Override + public void start(Stage self) throws Exception { + FXMLLoader loader=new FXMLLoader(appPop.this.getClass().getResource("/world/criver/imagecompresstool/fxml/pop.fxml")); + Scene sce=new Scene(loader.load()); + sce.setFill(null); + self.setScene(sce); + self.setTitle("结果提示框"); + self.setAlwaysOnTop(true); + + updateInfo(self); + + Stage parent=new Stage(); + parent.setOpacity(0); + parent.initStyle(StageStyle.UTILITY); + self.initStyle(StageStyle.TRANSPARENT); + self.initOwner(parent); + + daValue.pops.add(id); + + parent.show(); + self.show(); + + Screen sc=Screen.getPrimary(); + windows_w=sc.getBounds().getWidth(); + windows_h=sc.getBounds().getHeight(); + self.setX(windows_w-224); + self.setY(windows_h-114); + new Timer().schedule(new TimerTask() { + @Override + public void run() { + Platform.runLater(() -> { + self.setY(windows_h - 114 - daValue.pops.indexOf(id) * 72); + if (show_time > 0) show_time--; + if (show_time <= 0) { + double o=self.getOpacity() - 0.05; + self.setOpacity(o>=0?o:0); + if (o > 0) return; + self.hide(); + parent.hide(); + daValue.pops.remove(id); + } + }); + } + },new Date(),20); + } + private void updateInfo(Stage self){ + String mo=mode.contains("compress")?"压缩":"转ICO"; + String le=""; + switch (mode){ + case funThumb.mode_1 -> le="普"; + case funThumb.mode_2 -> le="高"; + case funThumb.mode_3 -> le="低"; + case funIcon.mode_auto -> le="自"; + case funIcon.mode_16x16 -> le="16"; + case funIcon.mode_32x32 -> le="32"; + case funIcon.mode_48x48 -> le="48"; + case funIcon.mode_64x64 -> le="64"; + case funIcon.mode_128x128 -> le="128"; + case funIcon.mode_256x256 -> le="256"; + default -> le="无"; + } + boolean ok=result[2].equals("true"); + long o=Long.parseLong(result[1]),n=Long.parseLong(result[4]); + funSize funSize=new funSize(); + Label re=((Label)self.getScene().lookup("#result")); + re.setText(ok?(mo+"成功"):(mo+"失败")); + re.setTextFill(ok?new Color(0.1,1,0.09,1):new Color(1,0.65,0.65,1)); + ((Label)self.getScene().lookup("#filename")).setText(result[0]); + ((Label)self.getScene().lookup("#level")).setText(le); + ((Label)self.getScene().lookup("#old_size")).setText(funSize.numToStr(o)); + Label to=((Label)self.getScene().lookup("#to_im")); + to.setText(ok?">":"x"); + to.setTextFill(ok?new Color(0.1,1,0.09,1):new Color(1,0.65,0.65,1)); + ((Label)self.getScene().lookup("#new_size")).setText(funSize.numToStr(n)); + ((Label)self.getScene().lookup("#pro")).setText(String.format("%.2f",(1-n*1.0/o)*100)+"%"); + } +} diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/contorller/conMaster.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/contorller/conMaster.java" new file mode 100644 index 0000000..fc2c326 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/contorller/conMaster.java" @@ -0,0 +1,405 @@ +package world.criver.imagecompresstool.contorller; + +import javafx.application.Platform; +import javafx.event.ActionEvent; +import javafx.event.EventTarget; +import javafx.fxml.Initializable; +import javafx.geometry.Insets; +import javafx.geometry.Pos; +import javafx.scene.AccessibleAttribute; +import javafx.scene.Node; +import javafx.scene.control.*; +import javafx.scene.control.cell.PropertyValueFactory; +import javafx.scene.input.*; +import javafx.scene.layout.AnchorPane; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.VBox; +import javafx.scene.paint.Color; +import javafx.scene.text.Font; +import javafx.scene.text.Text; +import javafx.stage.Stage; +import world.criver.imagecompresstool.application.appPop; +import world.criver.imagecompresstool.data.daConfig; +import world.criver.imagecompresstool.data.daValue; +import world.criver.imagecompresstool.function.funCache; +import world.criver.imagecompresstool.function.funIcon; +import world.criver.imagecompresstool.function.funSize; +import world.criver.imagecompresstool.function.funThumb; +import world.criver.imagecompresstool.modular.moRow; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.net.URL; +import java.util.*; + +public class conMaster implements Initializable{ + public AnchorPane ap; + public Label menu1; + public Label menu2; + public Label menu3; + private int scene_id=1; + private double press_x=-1,press_y=-1; + public void onWindowMin(MouseEvent e) { + daValue.master.setIconified(true); + } + + public void onWindowClose(MouseEvent e) { + daValue.master.hide(); + } + + public void onMenu1() { + updateMenuState(1); + createScene1(); + } + + public void onMenu2() { + updateMenuState(2); + createScene2(); + } + + public void onMenu3() { + updateMenuState(3); + createScene3(); + } + public void onTitlePress(MouseEvent e){ + press_x=e.getScreenX()-daValue.master.getX(); + press_y=e.getScreenY()-daValue.master.getY(); + + } + public void onTitleDrag(MouseEvent e){ + daValue.master.setX(e.getScreenX()-press_x); + daValue.master.setY(e.getScreenY()-press_y); + } + + public void onDragDrop(DragEvent e) { + if (scene_id == 3) return; + ap.getParent().setStyle("-fx-background-color: #00000000"); + List fs = e.getDragboard().getFiles(); + funCache funCache = new funCache(); + for (File f : fs) + if(f.isFile() && (f.getName().endsWith(".png")||f.getName().endsWith(".jpg"))) + funCache.add(new String[]{"mode:" + (scene_id==1?daConfig.mode_compress:daConfig.mode_ico), "file:" + f.getPath()}); + } + + public void onDragEnter(DragEvent e) { + if(scene_id==3)return; + ap.getParent().setStyle("-fx-background-color: #00000011"); + } + public void onDragOver(DragEvent e){ + if(e.getDragboard().hasFiles())e.acceptTransferModes(TransferMode.MOVE); + else e.consume(); + } + + /** + * 创建压缩界面 + */ + private void createScene1(){ + ap.getChildren().clear(); + Label tip=new Label("拖入图片,开始压缩"); + tip.setTextFill(new Color(0,0,0,0.1)); + tip.setFont(new Font(24)); + tip.setPrefWidth(300); + tip.setPrefHeight(220); + tip.setAlignment(Pos.CENTER); + ap.getChildren().add(tip); + VBox vb=new VBox(); + vb.setSpacing(4); + ap.getChildren().add(vb); + } + private void createScene2(){ + ap.getChildren().clear(); + Label tip=new Label("拖入图片,开始转Icon"); + tip.setTextFill(new Color(0,0,0,0.1)); + tip.setFont(new Font(24)); + tip.setPrefWidth(300); + tip.setPrefHeight(220); + tip.setAlignment(Pos.CENTER); + ap.getChildren().add(tip); + VBox vb=new VBox(); + vb.setSpacing(4); + ap.getChildren().add(vb); + } + private void createScene3(){ + ap.getChildren().clear(); + VBox box=new VBox(); + box.setSpacing(4); + ap.getChildren().add(box); + + Color gray=new Color(0,0,0,0.6); + + //压缩设置 + Label title1=new Label("压缩设置"); + title1.setFont(new Font(16)); + title1.setTextFill(gray); + box.getChildren().add(title1); + HBox l10=new HBox(); + l10.setSpacing(8); + box.getChildren().add(l10); + RadioButton l11=new RadioButton("普通品质"); + l11.setSelected(daConfig.mode_compress.equals("compress1")); + l11.setOnAction(e->{settingUpdateModeCompress(e);}); + l10.getChildren().add(l11); + RadioButton l12=new RadioButton("高品质"); + l12.setSelected(daConfig.mode_compress.equals("compress2")); + l12.setOnAction(e->{settingUpdateModeCompress(e);}); + l10.getChildren().add(l12); + RadioButton l13=new RadioButton("低品质"); + l13.setSelected(daConfig.mode_compress.equals("compress3")); + l13.setOnAction(e->{settingUpdateModeCompress(e);}); + l10.getChildren().add(l13); + CheckBox l14=new CheckBox("替换原图"); + l14.setSelected(daConfig.compress_replace); + l14.setOnAction(e->{settingUpdateReplaceCompress(e);}); + box.getChildren().add(l14); + + //转Ico设置 + Label title2=new Label("转Ico设置"); + title2.setFont(new Font(16)); + title2.setTextFill(gray); + box.getChildren().add(title2); + VBox l20=new VBox(); + l20.setSpacing(4); + box.getChildren().add(l20); + RadioButton l21=new RadioButton("自适应尺寸"); + l21.setSelected(daConfig.mode_ico.equals("ico1")); + l21.setOnAction(e->{settingUpdateModeIco(e);}); + l20.getChildren().add(l21); + HBox l201=new HBox(); + l201.setSpacing(8); + l20.getChildren().add(l201); + RadioButton l22=new RadioButton("16x16 px"); + l22.setSelected(daConfig.mode_ico.equals("ico2")); + l22.setOnAction(e->{settingUpdateModeIco(e);}); + l201.getChildren().add(l22); + RadioButton l23=new RadioButton("32x32 px"); + l23.setSelected(daConfig.mode_ico.equals("ico3")); + l23.setOnAction(e->{settingUpdateModeIco(e);}); + l201.getChildren().add(l23); + RadioButton l24=new RadioButton("48x48 px"); + l24.setSelected(daConfig.mode_ico.equals("ico4")); + l24.setOnAction(e->{settingUpdateModeIco(e);}); + l201.getChildren().add(l24); + HBox l202=new HBox(); + l202.setSpacing(8); + l20.getChildren().add(l202); + RadioButton l25=new RadioButton("64x64 px"); + l25.setSelected(daConfig.mode_ico.equals("ico5")); + l25.setOnAction(e->{settingUpdateModeIco(e);}); + l202.getChildren().add(l25); + RadioButton l26=new RadioButton("128x128 px"); + l26.setSelected(daConfig.mode_ico.equals("ico6")); + l26.setOnAction(e->{settingUpdateModeIco(e);}); + l202.getChildren().add(l26); + RadioButton l27=new RadioButton("256x256 px"); + l27.setSelected(daConfig.mode_ico.equals("ico7")); + l27.setOnAction(e->{settingUpdateModeIco(e);}); + l202.getChildren().add(l27); + + //其他设置 + Label title3=new Label("其他设置"); + title3.setFont(new Font(16)); + title3.setTextFill(gray); + box.getChildren().add(title3); + CheckBox l31=new CheckBox(); + l31.setText("开机自启"); + l31.setSelected(daConfig.bootstrap); + l31.setOnAction((e)->{ + daConfig.bootstrap=((CheckBox)e.getTarget()).isSelected(); + daConfig.save(); + }); + box.getChildren().add(l31); + CheckBox l32=new CheckBox(); + l32.setText("右键菜单"); + l32.setSelected(daConfig.content_menu); + l32.setOnAction((e)->{ + daConfig.content_menu=((CheckBox)e.getTarget()).isSelected(); + daConfig.save(); + }); + box.getChildren().add(l32); + CheckBox l33=new CheckBox(); + l33.setText("启动软件时打开窗口"); + l33.setSelected(daConfig.show_master); + l33.setOnAction((e)->{ + daConfig.show_master=((CheckBox)e.getTarget()).isSelected(); + daConfig.save(); + }); + box.getChildren().add(l33); + } + + /** + * 更改压缩设置品质设置 + * @param e + */ + private void settingUpdateModeCompress(ActionEvent e){ + RadioButton self= (RadioButton) e.getTarget(); + HBox vb= (HBox) self.getParent(); + for(int i=0;i{ + daValue.conMaster=conMaster.this; + onMenu1(); + new Timer().schedule(new listenClipboard(),new Date(),500); + }); + } + private String open_file=""; + private class listenClipboard extends TimerTask { + @Override + public void run() { + Platform.runLater(()-> { + File d=new File("cache"); + if(!d.exists() || d.isFile())return; + File[] ds=d.listFiles(); + if(ds.length==0)return; + if(ds[0].getName().equals(open_file))return; + open_file=ds[0].getName(); + try(BufferedReader re=new BufferedReader(new FileReader(ds[0]))){ + String a,b=""; + while((a=re.readLine())!=null)b+=a+"\n"; + daValue.commands=b.split("\n"); + }catch (Exception e){ + throw new RuntimeException(e); + } + if(daValue.commands==null)return; + String mode=null; + String fs=null; + long id=System.nanoTime(); + for(String i:daValue.commands){ + if(i.contains("mode:"))mode=i.substring(5); + if(i.contains("file:"))fs=i.substring(5); + } + Thread.startVirtualThread(new pictureProcessing(id,mode,fs)); + daValue.commands=null; + open_file=""; + ds[0].delete(); + }); + } + } + + private void addLine(long id,File f) { + Platform.runLater(() -> { + VBox vb = (VBox) ap.getChildren().get(1); + HBox hb = new HBox();//300 + hb.setPrefWidth(300); + hb.getStyleClass().add("line"); + hb.setId(id + ""); + Label name = new Label(f.getName()); + name.setPrefWidth(80); + name.setMaxWidth(80); + name.setTextFill(new Color(0, 0, 0, 0.6)); + hb.getChildren().add(name); + Tooltip tip = new Tooltip(f.getName()); + Tooltip.install(name, tip); + Label os = new Label(new funSize().countFileSize(f)); + os.setPrefWidth(70); + os.setAlignment(Pos.CENTER_RIGHT); + os.setTextFill(new Color(0, 0, 0, 0.5)); + hb.getChildren().add(os); + Label im = new Label(">"); + im.setPrefWidth(10); + im.setAlignment(Pos.CENTER); + im.setTextFill(new Color(0, 0, 0, 0.5)); + hb.getChildren().add(im); + vb.getChildren().add(hb); + }); + } + private class pictureProcessing implements Runnable { + private String mode=null,path=null; + private long id; + public pictureProcessing(long id,String mode,String path){ + this.mode=mode; + this.path=path; + this.id=id; + } + @Override + public void run() { + if(mode==null || path==null)return; + File o=new File(path); + if(!o.exists() || o.isDirectory())return; + if(scene_id==1 || scene_id==2)addLine(id,o); + ArrayList result=new ArrayList<>(); + if(mode.contains("compress"))result=new funThumb().thumb(o,mode); + else if(mode.contains("ico"))result=new funIcon().toIcon(o,mode); + for(String[] s:result){ + Platform.runLater(()->{ + try { + if(scene_id==1 || scene_id==2){ + VBox vb= (VBox) ap.getChildren().get(1); + Node n=vb.lookup("#"+id); + if(n!=null){ + boolean ok=s[2].equals("true"); + HBox hb= (HBox) n; + Label im= (Label) hb.getChildren().get(2); + im.setText(ok?">":"x"); + im.setTextFill(ok?new Color(0.1,1,0.09,1):new Color(1,0.65,0.65,1)); + Label nn=new Label(new funSize().numToStr(Long.parseLong(s[4]))); + nn.setTextFill(new Color(0,0,0,0.5)); + nn.setPrefWidth(70); + hb.getChildren().add(nn); + Label pp=new Label(String.format("%.2f",(1-Long.parseLong(s[4])*1.0/Long.parseLong(s[1]))*100)+"%"); + pp.setTextFill(new Color(0,0,0,0.5)); + pp.setPrefWidth(50); + pp.setAlignment(Pos.CENTER_RIGHT); + hb.getChildren().add(pp); + } + } + new appPop(id,mode,s).start(new Stage()); + } catch (Exception e) { + throw new RuntimeException(e); + } + }); + } + } + } +} diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daConfig.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daConfig.java" new file mode 100644 index 0000000..21fae55 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daConfig.java" @@ -0,0 +1,70 @@ +package world.criver.imagecompresstool.data; + +import world.criver.imagecompresstool.function.funReg; + +import java.io.*; + +public class daConfig { + /** + * 开机自启 + */ + public static boolean bootstrap=true; + /** + * 上下文菜单 + */ + public static boolean content_menu=true; + /** + * 启动是否打开 + */ + public static boolean show_master=true; + /** + * 压缩模式 + */ + public static String mode_compress="compress1"; + /** + * 转ico模式 + */ + public static String mode_ico="ico1"; + /** + * 压缩替换原图 + */ + public static boolean compress_replace=false; + + /** + * 加载配置文件 + */ + public static void load(){ + File f=new File("config.config"); + if(!f.exists())return; + try(BufferedReader re=new BufferedReader(new FileReader("config.config"))){ + String s; + while((s=re.readLine())!=null){ + if(s.contains("bootstrap="))bootstrap=Boolean.parseBoolean(s.substring(10)); + else if(s.contains("content_menu="))content_menu= Boolean.parseBoolean(s.substring(13)); + else if(s.contains("show_master="))show_master=Boolean.parseBoolean(s.substring(12)); + else if(s.contains("mode_compress="))mode_compress=s.substring(14); + else if(s.contains("mode_ico="))mode_ico=s.substring(9); + else if(s.contains("compress_replace="))compress_replace=Boolean.parseBoolean(s.substring(17)); + } + }catch (Exception e){ + throw new RuntimeException(e); + } + } + + /** + * 保存配置文件 + */ + public static void save(){ + try(BufferedWriter wr=new BufferedWriter(new FileWriter("config.config"))){ + wr.write("bootstrap="+bootstrap+"\n"); + wr.write("content_menu="+content_menu+"\n"); + wr.write("show_master="+show_master+"\n"); + wr.write("mode_compress="+mode_compress+"\n"); + wr.write("mode_ico="+mode_ico+"\n"); + wr.write("compress_replace="+compress_replace); + new funReg().change(); + }catch (Exception e){ + throw new RuntimeException(e); + } + } +} diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daFxml.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daFxml.java" new file mode 100644 index 0000000..0022339 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daFxml.java" @@ -0,0 +1,10 @@ +package world.criver.imagecompresstool.data; + +import javafx.fxml.FXMLLoader; + +/** + * 界面 + */ +public class daFxml { + public static final FXMLLoader master=new FXMLLoader(daFxml.class.getResource("/world/criver/imagecompresstool/fxml/master.fxml")); +} diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daMaterial.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daMaterial.java" new file mode 100644 index 0000000..fb0370f --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daMaterial.java" @@ -0,0 +1,10 @@ +package world.criver.imagecompresstool.data; + +import javafx.scene.image.Image; + +/** + * 图片 + */ +public class daMaterial { + public static final Image icon_32x32=new Image(daMaterial.class.getResource("/world/criver/imagecompresstool/material/ico_32x32.png").toString()); +} diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daValue.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daValue.java" new file mode 100644 index 0000000..074d80d --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/data/daValue.java" @@ -0,0 +1,56 @@ +package world.criver.imagecompresstool.data; + +import javafx.application.Platform; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.stage.Stage; +import world.criver.imagecompresstool.contorller.conMaster; + +import java.io.File; +import java.util.ArrayList; + +public class daValue { + /** + * 安装路径 + */ + public static String bin_url=""; + public static String[] commands=null; + public static long click_time=0; + public static Stage master=null; + public static Stage pop_menu=null; + public static Stage pop_parent=null; + public static conMaster conMaster; + public static ArrayList pops=new ArrayList<>(); + public static void iniBinUrl(){ + try { + File f = new File("_ic_"); + if (!f.exists() || f.isDirectory()) f.createNewFile(); + bin_url = f.getAbsolutePath().replace("\\_ic_",""); + }catch (Exception e){ + throw new RuntimeException(e); + } + } + public static void openPop(double x,double y){ + Platform.runLater(()->{ + pop_parent.show(); + pop_menu.show(); + pop_parent.setX(x); + pop_parent.setY(y-pop_menu.getHeight()-8); + pop_menu.setX(x); + pop_menu.setY(y-pop_menu.getHeight()-8); + }); + } + public static void hidePop(){ + Platform.runLater(()->{ + pop_menu.hide(); + pop_parent.hide(); + }); + } + public static void openMaster() { + Platform.runLater(() -> { + master.show(); + click_time = 0; + conMaster.onMenu1(); + }); + } +} diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funCache.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funCache.java" new file mode 100644 index 0000000..66fea11 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funCache.java" @@ -0,0 +1,23 @@ +package world.criver.imagecompresstool.function; + +import world.criver.imagecompresstool.data.daValue; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; + +public class funCache { + + public void add(String[] as){ + String qw = ""; + for (String i : as) qw += i + "\n"; + if(qw.length()<8)return; + File f = new File(daValue.bin_url+"/cache"); + if (!f.exists() || f.isFile()) f.mkdirs(); + try (BufferedWriter wr = new BufferedWriter(new FileWriter(daValue.bin_url+"/cache/" + System.nanoTime()))) { + wr.write(qw); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funIcon.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funIcon.java" new file mode 100644 index 0000000..b34f3da --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funIcon.java" @@ -0,0 +1,71 @@ +package world.criver.imagecompresstool.function; + +import org.apache.commons.imaging.ImageFormats; +import org.apache.commons.imaging.Imaging; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.File; +import java.util.ArrayList; + +public class funIcon { + public static final String mode_auto="ico1"; + public static final String mode_16x16="ico2"; + public static final String mode_32x32="ico3"; + public static final String mode_48x48="ico4"; + public static final String mode_64x64="ico5"; + public static final String mode_128x128="ico6"; + public static final String mode_256x256="ico7"; + + /** + * 转icon + * @param o + * @param mode + * @return list<[old_name,old_size,result,new_name,new_size]> + */ + public ArrayList toIcon(File o, String mode){ + try { + ArrayList re=new ArrayList<>(); + String nm = o.getName().substring(0, o.getName().lastIndexOf(".")); + BufferedImage oi = ImageIO.read(o); + switch (mode){ + case mode_16x16 -> re.add(getResult(o,oi,nm,16)); + case mode_32x32 -> re.add(getResult(o,oi,nm,32)); + case mode_48x48 -> re.add(getResult(o,oi,nm,48)); + case mode_64x64 -> re.add(getResult(o,oi,nm,64)); + case mode_128x128 -> re.add(getResult(o,oi,nm,128)); + case mode_256x256 -> re.add(getResult(o,oi,nm,256)); + default -> { + if(oi.getWidth()>=16 && oi.getHeight()>=16)re.add(getResult(o,oi,nm,16)); + if(oi.getWidth()>=32 && oi.getHeight()>=32)re.add(getResult(o,oi,nm,32)); + if(oi.getWidth()>=48 && oi.getHeight()>=48)re.add(getResult(o,oi,nm,48)); + if(oi.getWidth()>=64 && oi.getHeight()>=64)re.add(getResult(o,oi,nm,64)); + if(oi.getWidth()>=128 && oi.getHeight()>=128)re.add(getResult(o,oi,nm,128)); + if(oi.getWidth()>=256 && oi.getHeight()>=256)re.add(getResult(o,oi,nm,256)); + } + } + return re; + }catch (Exception e){ + throw new RuntimeException(e); + } + } + private String[] getResult(File o,BufferedImage oi,String nm,int size){ + nm=nm+"_"+size+"x"+size+".ico"; + File np=new File(o.getParent()+"/"+nm); + boolean r=writeIcon(oi,np,size); + return new String[]{o.getName(),o.length()+"",r+"",nm,(r? nm.length() : 0)+""}; + } + private boolean writeIcon(BufferedImage o,File np,int size){ + try { + BufferedImage n = new BufferedImage(size, size, BufferedImage.TYPE_4BYTE_ABGR); + Graphics g = n.getGraphics(); + g.drawImage(o, 0, 0, size, size, null); + Imaging.writeImage(n, np, ImageFormats.ICO); + return true; + }catch (Exception e){ + e.printStackTrace(); + return false; + } + } +} diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funLock.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funLock.java" new file mode 100644 index 0000000..a98a0df --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funLock.java" @@ -0,0 +1,36 @@ +package world.criver.imagecompresstool.function; + +import javafx.application.Platform; + +import java.io.*; + +public class funLock { + + /** + * 检测是否存在该线程 + * @return + */ + public boolean exist(){ + try { + int n=0; + Process p=new ProcessBuilder("cmd.exe","/c","tasklist | findstr \"ImageCompressTool.exe\"").start(); + try(BufferedReader re=new BufferedReader(new InputStreamReader(p.getInputStream(),"GBK"))){ + while(re.readLine()!=null)n++; + }catch (Exception ee){ + throw new RuntimeException(ee); + } + p.destroy(); + return n>1; + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + /** + * 将内容添加到剪切板 + * @param as + */ + public void clip(String[] as) { + new funCache().add(as); + } +} diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funReg.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funReg.java" new file mode 100644 index 0000000..a879cf0 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funReg.java" @@ -0,0 +1,109 @@ +package world.criver.imagecompresstool.function; + +import world.criver.imagecompresstool.data.daConfig; +import world.criver.imagecompresstool.data.daValue; + +import java.io.*; + +import static java.lang.StringTemplate.STR; + +public class funReg { + private String menu="ImageCompressTool_"; + private String parent=null; + private String bootstrap_url="HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"; + private String content_menu_url="HKEY_CURRENT_USER\\SOFTWARE\\Classes\\*\\shell"; + public void change(){ + parent=daValue.bin_url; + try { + if (daConfig.bootstrap) addBootstrap(); + else deleteBootstrap(); + if(daConfig.content_menu)addContentMenu(); + else deleteContentMenu(); + }catch (Exception e){ + throw new RuntimeException(e); + } + } + + /** + * 创建开机自启动 + */ + private void addBootstrap() throws IOException { + if(!exist(Runtime.getRuntime().exec(STR."reg query \{bootstrap_url}"),menu+"Bootstrap")) + destroyProcess(Runtime.getRuntime().exec(STR. "reg add \{ bootstrap_url } /v ImageCompressTool_Bootstrap /t REG_SZ /d \{ parent }\\ImageCompressTool.exe" )); + } + + /** + * 删除开启自启动 + * @throws IOException + */ + private void deleteBootstrap() throws IOException { + destroyProcess(Runtime.getRuntime().exec(STR."reg delete \{bootstrap_url} /v ImageCompressTool_Bootstrap /f")); + } + + /** + * 添加上下文菜单 + * @throws IOException + */ + private void addContentMenu() throws IOException { + if(!exist(Runtime.getRuntime().exec(STR."reg query \{content_menu_url}"), menu+"ContentMenu")){ + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu /v AppliesTo /t REG_SZ /d (System.ItemType:png) OR (System.ItemType:jpg)")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu /v MUIVerb /t REG_SZ /d 图片处理")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu /v icon /t REG_SZ /d \{parent}\\ic.ico")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu /v AppliesTo /t REG_SZ /d \"(System.ItemType:png) OR (System.ItemType:jpg)\"")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu /v SubCommands /t REG_SZ")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu1 /v MUIVerb /t REG_SZ /d 图片压缩")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu1 /v SubCommands /t REG_SZ")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu1\\shell\\menu11 /v MUIVerb /t REG_SZ /d 普通压缩")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu1\\shell\\menu11\\command /t REG_SZ /d \"\"\{parent}\\ImageCompressTool.exe\" \"mode:compress1\" file:\"\"%1\"\"\"")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu1\\shell\\menu12 /v MUIVerb /t REG_SZ /d 高质量压缩")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu1\\shell\\menu12\\command /t REG_SZ /d \"\"\{parent}\\ImageCompressTool.exe\" \"mode:compress2\" file:\"\"%1\"\"\"")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu1\\shell\\menu13 /v MUIVerb /t REG_SZ /d 低质量压缩")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu1\\shell\\menu13\\command /t REG_SZ /d \"\"\{parent}\\ImageCompressTool.exe\" \"mode:compress3\" file:\"\"%1\"\"\"")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2 /v MUIVerb /t REG_SZ /d 生成ico")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2 /v SubCommands /t REG_SZ")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2\\shell\\menu21 /v MUIVerb /t REG_SZ /d 自动尺寸")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2\\shell\\menu21\\command /t REG_SZ /d \"\"\{parent}\\ImageCompressTool.exe\" \"mode:ico1\" file:\"\"%1\"\"\"")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2\\shell\\menu22 /v MUIVerb /t REG_SZ /d 16x16")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2\\shell\\menu22\\command /t REG_SZ /d \"\"\{parent}\\ImageCompressTool.exe\" \"mode:ico2\" file:\"\"%1\"\"\"")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2\\shell\\menu23 /v MUIVerb /t REG_SZ /d 32x32")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2\\shell\\menu23\\command /t REG_SZ /d \"\"\{parent}\\ImageCompressTool.exe\" \"mode:ico3\" file:\"\"%1\"\"\"")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2\\shell\\menu24 /v MUIVerb /t REG_SZ /d 48x48")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2\\shell\\menu24\\command /t REG_SZ /d \"\"\{parent}\\ImageCompressTool.exe\" \"mode:ico4\" file:\"\"%1\"\"\"")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2\\shell\\menu25 /v MUIVerb /t REG_SZ /d 64x64")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2\\shell\\menu25\\command /t REG_SZ /d \"\"\{parent}\\ImageCompressTool.exe\" \"mode:ico5\" file:\"\"%1\"\"\"")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2\\shell\\menu26 /v MUIVerb /t REG_SZ /d 128x128")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2\\shell\\menu26\\command /t REG_SZ /d \"\"\{parent}\\ImageCompressTool.exe\" \"mode:ico6\" file:\"\"%1\"\"\"")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2\\shell\\menu27 /v MUIVerb /t REG_SZ /d 256x256")); + destroyProcess(Runtime.getRuntime().exec(STR."reg add \{content_menu_url}\\\{menu}ContentMenu\\shell\\menu2\\shell\\menu27\\command /t REG_SZ /d \"\"\{parent}\\ImageCompressTool.exe\" \"mode:ico7\" file:\"\"%1\"\"\"")); + } + } + + /** + * 删除上下文菜单 + * @throws IOException + */ + private void deleteContentMenu() throws IOException { + destroyProcess(Runtime.getRuntime().exec(STR."reg delete \{content_menu_url}\\\{menu}ContentMenu /f")); + } + private void destroyProcess(Process p){ + try { + p.waitFor(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + if(p.isAlive())p.destroy(); + } + private boolean exist(Process p,String key) throws IOException { + BufferedReader re=new BufferedReader(new InputStreamReader(p.getInputStream(),"GBK")); + String l; + boolean ok=false; + while((l=re.readLine())!=null) { + if (l.contains(key)) { + ok = true; + break; + } + } + p.destroy(); + return ok; + } +} diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funSize.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funSize.java" new file mode 100644 index 0000000..3e6d3d8 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funSize.java" @@ -0,0 +1,29 @@ +package world.criver.imagecompresstool.function; + +import java.io.File; + +public class funSize { + public String numToStr(long size){ + double a=size; + String end="B"; + if(a>1024){ + a/=1024; + end="KB"; + } + if(a>1024){ + a/=1024; + end="MB"; + } + if(a>1024){ + a/=1024; + end="GB"; + } + return String.format("%.2f %s",a,end); + } + public String countFileSize(File f){ + return numToStr(f.length()); + } + public String countFileSize(String path){ + return numToStr(new File(path).length()); + } +} diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funThumb.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funThumb.java" new file mode 100644 index 0000000..b285ab1 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funThumb.java" @@ -0,0 +1,65 @@ +package world.criver.imagecompresstool.function; + +import net.coobird.thumbnailator.Thumbnails; +import com.monchstudio.image.png.PngCompressor; +import world.criver.imagecompresstool.data.daConfig; + +import java.io.File; +import java.util.ArrayList; + +public class funThumb { + public static final String mode_auto="compress0"; + public static final String mode_1="compress1"; + public static final String mode_2="compress2"; + public static final String mode_3="compress3"; + /** + * 压缩图片 + * @param of + * @return list<[old_name,old_size,result,new_name,new_size]> + */ + public ArrayList thumb(File of, String mode) { + ArrayList re=new ArrayList<>(); + switch (mode){ + case mode_2 -> re.add(getThumbResult(of,0.9,"high")); + case mode_1 -> re.add(getThumbResult(of,0.7,"medium")); + case mode_3 -> re.add(getThumbResult(of,0.5,"low")); + default -> { + re.add(getThumbResult(of,0.9,"high")); + re.add(getThumbResult(of,0.7,"medium")); + re.add(getThumbResult(of,0.5,"low")); + } + } + return re; + } + private String[] getThumbResult(File o,double q,String mode){ + String name=""; + long ol=o.length(); + if(daConfig.compress_replace)name=o.getName(); + else name=o.getName().replaceAll("\\.png","_thumb_"+mode+".png").replaceAll("\\.jpg","_thumb_"+mode+".jpg"); + File n=new File(o.getParent()+"/"+name); + boolean r=false; + if(o.getName().endsWith(".png"))r=thumbPng(o,n); + else if(o.getName().endsWith(".jpg"))r=thumbJpg(o,n,q); + return new String[]{o.getName(),ol+"",r+"",n.getName(),(r?n.length():0)+""}; + } + private boolean thumbJpg(File of,File nf,double quality){ + try { + Thumbnails.of(of) + .scale(1) + .outputQuality(quality) + .toFile(nf); + return true; + }catch (Exception e){ + e.printStackTrace(); + return false; + } + } + private boolean thumbPng(File of,File nf){ + try { + PngCompressor.compress(of, nf); + return true; + }catch (Exception e){ + return false; + } + } +} diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funTray.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funTray.java" new file mode 100644 index 0000000..00bf779 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/function/funTray.java" @@ -0,0 +1,123 @@ +package world.criver.imagecompresstool.function; + +import javafx.application.Platform; +import javafx.event.Event; +import javafx.scene.Scene; +import javafx.scene.control.Label; +import javafx.scene.layout.BorderPane; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; +import javafx.stage.StageStyle; +import world.criver.imagecompresstool.data.daValue; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +/** + * 系统托盘 + */ +public class funTray { + /** + * 初始化托盘 + */ + public void iniTray(){ + try { + if (!SystemTray.isSupported()) return; + SystemTray tray = SystemTray.getSystemTray(); + Image icon = Toolkit.getDefaultToolkit().createImage(funTray.class.getResource("/world/criver/imagecompresstool/material/ico_32x32.png")); + TrayIcon ico = new TrayIcon(icon, "图片处理工具"); + ico.setImageAutoSize(true); + tray.add(ico); + ico.addMouseListener(new MouseListener() { + @Override + public void mouseClicked(MouseEvent e) { + if(e.getButton()==3){ + SwingUtilities.invokeLater(()->{daValue.openPop(e.getXOnScreen(),e.getYOnScreen());}); + } + } + @Override + public void mousePressed(MouseEvent e) { + if(e.getButton()!=1)return; + long a=System.currentTimeMillis(); + if(a- daValue.click_time<500){ + SwingUtilities.invokeLater(daValue::openMaster); + }else daValue.click_time=a; + } + @Override + public void mouseReleased(MouseEvent e) {} + @Override + public void mouseEntered(MouseEvent e) {} + @Override + public void mouseExited(MouseEvent e) {} + }); + }catch (Exception e){ + throw new RuntimeException(e); + } + } + + /** + * 初始化右键菜单 + */ + public void iniPopMenu(){ + Platform.runLater(()->{ + Stage pa=new Stage(); + pa.initStyle(StageStyle.UTILITY); + pa.setOpacity(0); + Stage pop=new Stage(); + VBox vb=new VBox(); + vb.getStylesheets().add(funTray.class.getResource("/world/criver/imagecompresstool/css/context_menu.css").toString()); + vb.getStyleClass().add("vbox"); + Label l1=new javafx.scene.control.Label("打开"); + Label l2=new javafx.scene.control.Label("退出"); + l1.getStyleClass().add("label"); + l2.getStyleClass().add("label"); + vb.getChildren().add(l1); + vb.getChildren().add(l2); + Scene sc=new Scene(vb); + sc.setFill(null); + pop.setScene(sc); + pop.initStyle(StageStyle.TRANSPARENT); + pop.initOwner(pa); + pa.setAlwaysOnTop(true); + pop.focusedProperty().addListener((a,o,n)->{ + if(!n){ + daValue.hidePop(); + } + }); + l1.setOnMouseClicked(e->{daValue.openMaster();}); + l2.setOnMouseClicked(e->{System.exit(0);}); + daValue.pop_parent=pa; + daValue.pop_menu=pop; + }); + } + + /** + * javafx保活 + */ + public void keepAlive(){ + Platform.runLater(()->{ + Stage pa=new Stage(); + pa.setWidth(1); + pa.setHeight(1); + pa.setX(-100); + pa.setY(-100); + pa.setOpacity(0); + pa.initStyle(StageStyle.UTILITY); + BorderPane bp=new BorderPane(); + Scene sc=new Scene(bp); + sc.setFill(null); + Stage ch=new Stage(); + ch.setScene(sc); + ch.setWidth(1); + ch.setHeight(1); + ch.setX(-100); + ch.setY(-100); + ch.initStyle(StageStyle.TRANSPARENT); + ch.initOwner(pa); + pa.show(); + ch.show(); + }); + } +} diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/modular/moRow.java" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/modular/moRow.java" new file mode 100644 index 0000000..b715537 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/java/world/criver/imagecompresstool/modular/moRow.java" @@ -0,0 +1,102 @@ +package world.criver.imagecompresstool.modular; + +public class moRow { + private String name; + private long old_size; + private byte active=0;//压缩中 + private long new_size=0; + private float pro=0; + private boolean replace=false; + + public moRow(String name, long old_size) { + this.name=name; + setOld_size(old_size); + } + + public String getPro0(){ + return String.format("%.2f",pro*100)+"%"; + } + public String getOldSize(){ + return formatSize(old_size); + } + public String getNewSize(){ + return formatSize(new_size); + } + private String formatSize(long size){ + double a=size; + String q="B"; + if(a>1024){ + a/=1024; + q="KB"; + } + if(a>1024){ + a/=1024; + q="MB"; + } + if(a>1024){ + a/=1024; + q="GB"; + } + return String.format("%.2f%s",a,q); + } + + public float getPro() { + return pro; + } + + public void setPro(float pro) { + this.pro = pro; + } + + public long getNew_size() { + return new_size; + } + + public void setNew_size(long new_size) { + this.new_size = new_size; + this.pro=(this.old_size-this.new_size)*1.0f/this.old_size; + } + + public String getResult() { + if(active==0)return "压缩中..."; + if(active==1)return "完成"; + return "失败"; + } + + public void setResult(String result) { + result = result; + } + + public long getOld_size() { + return old_size; + } + + public void setOld_size(long old_size) { + this.old_size = old_size; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public byte getActive(){ + return active; + } + public void setActive(byte a){ + this.active=a; + } + public void addActive(){ + active++; + } + + public boolean isReplace() { + return replace; + } + + public void setReplace(boolean replace) { + this.replace = replace; + } +} diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/css/context_menu.css" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/css/context_menu.css" new file mode 100644 index 0000000..ae88f50 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/css/context_menu.css" @@ -0,0 +1,17 @@ +.vbox{ + -fx-padding: 6px 0 6px 0; + -fx-background-color: #fff; + -fx-background-radius: 8px; +} +.vbox .label{ + -fx-text-fill: #444; + -fx-alignment: center; + -fx-min-width: 40px; + -fx-min-height: 20px; +} +.vbox .label:hover{ + -fx-background-color: #ddd; +} +.vbox .label:pressed{ + -fx-background-color: #ccc; +} \ No newline at end of file diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/css/master.css" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/css/master.css" new file mode 100644 index 0000000..afef878 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/css/master.css" @@ -0,0 +1,84 @@ +.border-pane{ + -fx-background-color: #fff; + -fx-background-radius: 12px; + -fx-border-radius: 12px; + -fx-border-color: #eee; +} +.window_min{ + -fx-text-fill: #888; + -fx-background-radius: 4px; +} +.window_min:hover{ + -fx-background-color: #eee; + -fx-text-fill: #e19a53; +} +.window_min:pressed{ + -fx-background-color: #e1e1e1; + -fx-text-fill: #e19a53; +} +.window_close{ + -fx-text-fill: #888; + -fx-background-radius: 4px; +} +.window_close:hover{ + -fx-background-color: #eee; + -fx-text-fill: #e15353; +} +.window_close:pressed{ + -fx-background-color: #e1e1e1; + -fx-text-fill: #e15353; +} +.menu_item{ + -fx-text-fill: #888; + -fx-background-radius: 6px; +} +.menu_item:hover{ + -fx-background-color: #eee; +} +.menu_item:pressed{ + -fx-background-color: #e1e1e1; +} +.menu_item_selected{ + -fx-background-color: #eee; + -fx-text-fill: #444; +} +.scroll-pane,.scroll-pane .viewport,.scroll-pane .anchor-pane,.scroll-bar,.scroll-bar .track{ + -fx-background-color: #00000000; +} +.scroll-bar .thumb,.scroll-bar .decrement-arrow,.scroll-bar .increment-arrow{ + -fx-background-color: #eee; +} +.check-box,.radio-button{ + -fx-text-fill: #888; +} +.check-box .box,.radio-button .radio{ + -fx-background-color: #00000000; + -fx-border-color: #aaa; +} +.check-box .box{ + -fx-border-radius: 6px; +} +.radio-button .radio{ + -fx-border-radius: 8px; +} +.check-box .box:hover,.radio-button .radio:hover{ + -fx-border-color: #777; +} +.check-box:selected .mark{ + -fx-background-color: #4dc234; +} +.check-box .box{ + -fx-background-color: #00000000; + -fx-border-color: #aaa; +} +.radio-button:selected .dot{ + -fx-background-color: #4dc234; +} +.line{ + -fx-background-color: #00000000; + -fx-background-radius: 6px; + -fx-padding: 4px 0 4px 4px; +} +.line:hover{ + -fx-background-color: #00000011; +} \ No newline at end of file diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/fxml/master.fxml" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/fxml/master.fxml" new file mode 100644 index 0000000..60b1bd7 --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/fxml/master.fxml" @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + +
+
diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/fxml/pop.fxml" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/fxml/pop.fxml" new file mode 100644 index 0000000..a6eb95f --- /dev/null +++ "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/fxml/pop.fxml" @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+
diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/material/ic.ico" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/material/ic.ico" new file mode 100644 index 0000000000000000000000000000000000000000..b0444c78870a713bdcbfbb46bd246a6dda1bb392 GIT binary patch literal 4286 zcmd6r&r4fD5XZOR$%6I=h{yEiS=yq9f@eWnq0&D=EBZHh=s)906fZ3ry-5!}^eU(k zf>k_L3$Y;Md^S$9eZH5DkmUKoxVy98o$u_-nzxe>p6I7i3H%Lf&q5dpA&jZ0Dom-M zkB`p1eA<+zB7_&4ACLi+S1RvSj#Z>bf^9h9g44L)Y5%LrkxE0QSNzz911>mi-;8_3 zS!5SZi#a~YbCuzZSsB`xDHP_xW&JH$TZGs3a9X|_tRLO_DC64;GO@cX6V)71J@epF z9}3qN;O~4V7p=2~pVP)V0{zg}586T?N_7DH))_jZw_UHCj zW$)r=#8~XWqhk(CUhXUg?Hn%38^wP5{zdn57WruzqaWX1jJ)t$%-N&yfU&bf-~0k& zzNfh}e%dsiuXjGn!S8zHr)8YR5Pr@nIp$%n@PT0t$>t@^UCNv7N85V-i6aj!dqQtm z4<FP*!^jhfl4f literal 0 HcmV?d00001 diff --git "a/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/material/ico_32x32.png" "b/\345\233\276\347\211\207\345\216\213\347\274\251\345\260\217\345\267\245\345\205\267_java/ImageCompressTool/src/main/resources/world/criver/imagecompresstool/material/ico_32x32.png" new file mode 100644 index 0000000000000000000000000000000000000000..d828e88abb18f518af2753196eb9569cde9af91b GIT binary patch literal 233 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?3oVGw3ym^DWNC^*~G z#W5tJ_3iYtybTIGt(lKmHi=L4?0j>Sr$T9^LPpOPxnFrE6TS!j<9afOcWVDPnI91c zRTt!HFl_FvR?tZFvz>T*hgi<mh!Po&tw0Yq5pXA#=ZZJ{Yl_F!q`^buc=|Wp@wtAgaT=C d{|W!*$#1^plwE0KwH@e822WQ%mvv4FO#phySj+$b literal 0 HcmV?d00001 -- Gitee