From 4e06ad8bb5880989a0944825bc8744474851bc6a Mon Sep 17 00:00:00 2001 From: Administrator Date: Tue, 11 May 2021 09:01:31 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0convertToSmallFontFile?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/sample/FontMakeUtil.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/sample/FontMakeUtil.java b/src/main/java/sample/FontMakeUtil.java index b9db397..47b3fdc 100644 --- a/src/main/java/sample/FontMakeUtil.java +++ b/src/main/java/sample/FontMakeUtil.java @@ -12,6 +12,14 @@ import java.io.IOException; */ public class FontMakeUtil { static File file = null; + /** + * 功能描述:
+ * 〈将words字符串中字符创建为一个字库,fileSrc为完整字库绝对路径,fileDes为精简字库绝对路径〉 + * @Param: [words, fileSrc, fileDes] + * @Return: void + * @Author: Administrator + * @Date: 2021/03/15 21:24 + */ public static void convertToSmallFontFile(String words,String fileSrc,String fileDes) { boolean isExist = (file = new File(fileDes)).exists(); if(isExist){ -- Gitee From 845c5c5accc8ef0c3c22ddc0c100c00f09d108c2 Mon Sep 17 00:00:00 2001 From: Administrator Date: Tue, 11 May 2021 09:02:45 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0version=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/sample/LocalServer.java | 33 +++++++++++++++++++++++---- src/main/resources/version.json | 5 ++++ 2 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 src/main/resources/version.json diff --git a/src/main/java/sample/LocalServer.java b/src/main/java/sample/LocalServer.java index c786f43..9468d2c 100644 --- a/src/main/java/sample/LocalServer.java +++ b/src/main/java/sample/LocalServer.java @@ -1,15 +1,11 @@ package sample; - import cn.hutool.http.HttpUtil; import cn.hutool.http.server.SimpleServer; import cn.hutool.json.JSONUtil; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; +import java.io.*; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Paths; @@ -61,6 +57,33 @@ public class LocalServer { String filePath = MainController.getBasicFilePath()+ File.separator+fileName; Files.write(Paths.get(filePath),output.getBytes(Charset.defaultCharset())); }); + //用来处理前端传来的数据 + server.addAction("/version", (request, res) -> { + OutputStream out = res.getOut(); + try { + BufferedReader in = new BufferedReader(new InputStreamReader(LocalServer.class.getClassLoader().getResourceAsStream("version.json"),Charset.forName("UTF-8"))); + StringBuffer buffer = new StringBuffer(); + String line = ""; + while ((line = in.readLine()) != null){ + buffer.append(line); + } + String input = buffer.toString(); + + out.write(input.getBytes("GB2312")); + out.flush(); + } catch (Exception e) { + e.printStackTrace(); + }finally { + if (out!=null) { + try { + out.close(); + } catch (IOException e1) { + e1.printStackTrace(); + } + } + } + }); server.start(); } + } \ No newline at end of file diff --git a/src/main/resources/version.json b/src/main/resources/version.json new file mode 100644 index 0000000..334a380 --- /dev/null +++ b/src/main/resources/version.json @@ -0,0 +1,5 @@ +{ + "version": "1.0.0", + "desc":"1.引入版本号。\r\n2. 根据版本号进行自动更新。\r\n3. 修复若干bug。", + "date":"2021-05-01 00:00:01" +} \ No newline at end of file -- Gitee From bcdd6529b16939ef8854b9eec4a63a392dfb9755 Mon Sep 17 00:00:00 2001 From: Administrator Date: Tue, 11 May 2021 10:11:46 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0ping=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E5=B0=81=E8=A3=85=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/sample/CommonUtil.java | 25 +++++++++ src/main/java/sample/LocalServer.java | 12 ++--- src/main/java/sample/Main.java | 3 ++ src/main/java/sample/UpdateUtil.java | 73 +++++++++++++++++++++++++++ 4 files changed, 105 insertions(+), 8 deletions(-) create mode 100644 src/main/java/sample/CommonUtil.java create mode 100644 src/main/java/sample/UpdateUtil.java diff --git a/src/main/java/sample/CommonUtil.java b/src/main/java/sample/CommonUtil.java new file mode 100644 index 0000000..8ba563a --- /dev/null +++ b/src/main/java/sample/CommonUtil.java @@ -0,0 +1,25 @@ +package sample; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; + +/** + * @author: Administrator + * @date: 2021/05/11 9:36 + * @description: + */ +public class CommonUtil { + + public static String getStringFromInputStream(InputStream inputStream,Charset charset) throws IOException { + BufferedReader in = new BufferedReader(new InputStreamReader(inputStream,charset)); + StringBuffer buffer = new StringBuffer(); + String line = ""; + while ((line = in.readLine()) != null){ + buffer.append(line); + } + return buffer.toString(); + } +} diff --git a/src/main/java/sample/LocalServer.java b/src/main/java/sample/LocalServer.java index 9468d2c..5d4035e 100644 --- a/src/main/java/sample/LocalServer.java +++ b/src/main/java/sample/LocalServer.java @@ -61,14 +61,8 @@ public class LocalServer { server.addAction("/version", (request, res) -> { OutputStream out = res.getOut(); try { - BufferedReader in = new BufferedReader(new InputStreamReader(LocalServer.class.getClassLoader().getResourceAsStream("version.json"),Charset.forName("UTF-8"))); - StringBuffer buffer = new StringBuffer(); - String line = ""; - while ((line = in.readLine()) != null){ - buffer.append(line); - } - String input = buffer.toString(); - + InputStream inputStream = LocalServer.class.getClassLoader().getResourceAsStream("version.json"); + String input = CommonUtil.getStringFromInputStream(inputStream,Charset.forName("UTF-8")); out.write(input.getBytes("GB2312")); out.flush(); } catch (Exception e) { @@ -86,4 +80,6 @@ public class LocalServer { server.start(); } + + } \ No newline at end of file diff --git a/src/main/java/sample/Main.java b/src/main/java/sample/Main.java index 5f67491..6137ec7 100644 --- a/src/main/java/sample/Main.java +++ b/src/main/java/sample/Main.java @@ -20,6 +20,9 @@ public class Main extends Application { primaryStage.getIcons().add(icon); primaryStage.show(); LocalServer.startLocalServer(); + System.out.println( + UpdateUtil.isOnline("www.baidu.com",1,150) + ); } diff --git a/src/main/java/sample/UpdateUtil.java b/src/main/java/sample/UpdateUtil.java new file mode 100644 index 0000000..5ec620b --- /dev/null +++ b/src/main/java/sample/UpdateUtil.java @@ -0,0 +1,73 @@ +package sample; + + +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.Charset; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * @author: Administrator + * @date: 2021/05/11 9:29 + * @description:自动更新工具类 + */ +public class UpdateUtil { + + private static final Pattern PING_PATTERN = Pattern.compile("(\\d+ms)(\\s+)(TTL=\\d+)", Pattern.CASE_INSENSITIVE); + + /** + * 功能描述:
+ * 〈ping命令封装〉 + * @Param: [ipAddress, pingTimes, timeOut] + * @Return: boolean + * @Author: Administrator + * @Date: 2021/05/11 10:01 + */ + public static boolean isOnline(String ipAddress,int pingTimes,int timeOut){ + Runtime runtime = Runtime.getRuntime(); + String pingCommand = "ping " + ipAddress + " -n " + pingTimes + " -w " + timeOut; + InputStream inputStream = null; + try { + Process exec = runtime.exec(pingCommand); + if(exec==null){ + return false; + } + + inputStream = exec.getInputStream(); + String result = CommonUtil.getStringFromInputStream(inputStream,Charset.forName("GB2312")); + if(getCheckResult(result)==1){ + return true; + } + } catch (IOException e) { + e.printStackTrace(); + return false; + }finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return false; + } + + + /** + * 功能描述:
+ * 〈若line含有=18ms TTL=16字样,说明已经ping通,返回1,否則返回0.〉 + * @Param: [line] + * @Return: int + * @Author: Administrator + * @Date: 2021/05/11 10:02 + */ + private static int getCheckResult(String line) { + Matcher matcher = PING_PATTERN.matcher(line); + while (matcher.find()) { + return 1; + } + return 0; + } +} -- Gitee From 43cebdf49934ef3dbf32aebc3042c175fcdfa288 Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 12 May 2021 09:02:21 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=A2=E9=97=AE?= =?UTF-8?q?=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/elements/ConfirmWin.java | 34 +++++++++++++++++++++++++ src/main/java/elements/Navigatebar.java | 10 ++------ 2 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 src/main/java/elements/ConfirmWin.java diff --git a/src/main/java/elements/ConfirmWin.java b/src/main/java/elements/ConfirmWin.java new file mode 100644 index 0000000..7f802b0 --- /dev/null +++ b/src/main/java/elements/ConfirmWin.java @@ -0,0 +1,34 @@ +package elements; + +import javafx.scene.control.Alert; +import javafx.scene.control.ButtonBar; +import javafx.scene.control.ButtonType; + +import java.util.Optional; + +/** + * @author: Administrator + * @date: 2021/05/11 16:57 + * @description: + */ +public class ConfirmWin { + public static boolean isOk = false; + public ConfirmWin(){ + // 创建一个确认对话框 + Alert alert = new Alert(Alert.AlertType.CONFIRMATION); + // 设置对话框的头部文本 + alert.setHeaderText("提示"); + // 设置对话框的内容文本 + alert.setContentText("发现新版本,是否需要在线更新?"); + // 显示对话框,并等待按钮返回 + Optional buttonType = alert.showAndWait(); + // 判断返回的按钮类型是确定还是取消,再据此分别进一步处理 + // 单击了取消按钮CANCEL_CLOSE + // 单击了确定按钮OK_DONE + if (buttonType.get().getButtonData().equals(ButtonBar.ButtonData.OK_DONE)) { + isOk = true; + } else { + isOk = false; + } + } +} diff --git a/src/main/java/elements/Navigatebar.java b/src/main/java/elements/Navigatebar.java index bb02279..c008519 100644 --- a/src/main/java/elements/Navigatebar.java +++ b/src/main/java/elements/Navigatebar.java @@ -1,21 +1,15 @@ package elements; -import javafx.beans.value.ObservableValue; -import javafx.concurrent.Worker; -import ref.Path; -import ref.R; import javafx.geometry.Pos; import javafx.scene.effect.DropShadow; import javafx.scene.input.MouseEvent; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; +import ref.Path; +import ref.R; import sample.MainController; -import java.io.IOException; -import java.nio.charset.Charset; -import java.nio.file.Files; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; -- Gitee From 52ea878074342fc3eb2e098c762340d836f6e823 Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 12 May 2021 09:06:24 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E5=B0=B1=E8=AF=A2=E9=97=AE=E6=98=AF=E5=90=A6=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 10 ++++++++-- src/main/java/sample/CommonUtil.java | 14 ++++++++++---- src/main/java/sample/Main.java | 15 +++++++++++---- src/main/java/sample/UpdateUtil.java | 15 +++++++-------- src/main/java/sample/WebViewUtil.java | 15 ++++++++------- 5 files changed, 44 insertions(+), 25 deletions(-) diff --git a/pom.xml b/pom.xml index 6ca4b27..09c6e6a 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ true libs/ - com.ankept.MainApp + sample.Main @@ -89,7 +89,7 @@ 8.8.3 com.ankept.www - simple.Main + sample.Main @@ -121,5 +121,11 @@ hutool-all 5.5.0 + + org.apache.commons + commons-lang3 + 3.3.2 + + \ No newline at end of file diff --git a/src/main/java/sample/CommonUtil.java b/src/main/java/sample/CommonUtil.java index 8ba563a..18643fe 100644 --- a/src/main/java/sample/CommonUtil.java +++ b/src/main/java/sample/CommonUtil.java @@ -1,9 +1,6 @@ package sample; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; +import java.io.*; import java.nio.charset.Charset; /** @@ -22,4 +19,13 @@ public class CommonUtil { } return buffer.toString(); } + + public static String getFilePath(){ + String jarWholePath = Main.class.getProtectionDomain().getCodeSource().getLocation().getFile(); + try { + jarWholePath = java.net.URLDecoder.decode(jarWholePath, "UTF-8"); + } catch (UnsupportedEncodingException e) { System.out.println(e.toString()); } + String jarPath = new File(jarWholePath).getParentFile().getAbsolutePath(); + return jarPath; + } } diff --git a/src/main/java/sample/Main.java b/src/main/java/sample/Main.java index 6137ec7..cd0b74c 100644 --- a/src/main/java/sample/Main.java +++ b/src/main/java/sample/Main.java @@ -1,5 +1,7 @@ package sample; +import com.mohamnag.fxwebview_debugger.DevToolsDebuggerServer; +import elements.ConfirmWin; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; @@ -19,10 +21,15 @@ public class Main extends Application { Image icon = new Image(R.ICON, 32, 32, false, false); primaryStage.getIcons().add(icon); primaryStage.show(); - LocalServer.startLocalServer(); - System.out.println( - UpdateUtil.isOnline("www.baidu.com",1,150) - ); + if (UpdateUtil.isOnline("www.baidu.com",1,150)){ + ConfirmWin confirmWin = new ConfirmWin(); + if(ConfirmWin.isOk){ + DevToolsDebuggerServer.stopDebugServer(); + RuntimeUtil.restartApp(); + }else { + LocalServer.startLocalServer(); + } + } } diff --git a/src/main/java/sample/UpdateUtil.java b/src/main/java/sample/UpdateUtil.java index 5ec620b..77f9f56 100644 --- a/src/main/java/sample/UpdateUtil.java +++ b/src/main/java/sample/UpdateUtil.java @@ -1,6 +1,5 @@ package sample; - import java.io.IOException; import java.io.InputStream; import java.nio.charset.Charset; @@ -25,23 +24,20 @@ public class UpdateUtil { * @Date: 2021/05/11 10:01 */ public static boolean isOnline(String ipAddress,int pingTimes,int timeOut){ - Runtime runtime = Runtime.getRuntime(); String pingCommand = "ping " + ipAddress + " -n " + pingTimes + " -w " + timeOut; + String result = ""; InputStream inputStream = null; + Runtime runtime = Runtime.getRuntime(); + try { Process exec = runtime.exec(pingCommand); if(exec==null){ return false; } - inputStream = exec.getInputStream(); - String result = CommonUtil.getStringFromInputStream(inputStream,Charset.forName("GB2312")); - if(getCheckResult(result)==1){ - return true; - } + result = CommonUtil.getStringFromInputStream(inputStream,Charset.forName("GB2312")); } catch (IOException e) { e.printStackTrace(); - return false; }finally { if (inputStream != null) { try { @@ -51,6 +47,9 @@ public class UpdateUtil { } } } + if(getCheckResult(result)==1){ + return true; + } return false; } diff --git a/src/main/java/sample/WebViewUtil.java b/src/main/java/sample/WebViewUtil.java index 134a9b8..e2ef38c 100644 --- a/src/main/java/sample/WebViewUtil.java +++ b/src/main/java/sample/WebViewUtil.java @@ -27,16 +27,17 @@ public class WebViewUtil { webEngine = centerWebView.getEngine(); } try { - DevToolsDebuggerServer.startDebugServer(webEngine.impl_getDebugger(), 51742); + int debugPort = 51742; + DevToolsDebuggerServer.startDebugServer(webEngine.impl_getDebugger(), debugPort); + com.sun.javafx.webkit.WebConsoleListener.setDefaultListener(new com.sun.javafx.webkit.WebConsoleListener() { + @Override + public void messageAdded(WebView webView, String message, int lineNumber, String sourceId) { + System.out.println("Console: " + message + " [" + sourceId + ":" + lineNumber + "] "); + } + }); } catch (Exception e) { e.printStackTrace(); } - com.sun.javafx.webkit.WebConsoleListener.setDefaultListener(new com.sun.javafx.webkit.WebConsoleListener() { - @Override - public void messageAdded(WebView webView, String message, int lineNumber, String sourceId) { - System.out.println("Console: " + message + " [" + sourceId + ":" + lineNumber + "] "); - } - }); webEngine.setJavaScriptEnabled(true); //获取当前Java版本 -- Gitee From 44d6a880e7ffdeb06cf46e269474c938c330f95f Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 12 May 2021 09:10:24 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E8=BF=90=E8=A1=8C=E6=97=B6=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=EF=BC=8C=E6=89=A7=E8=A1=8C=E5=91=BD=E4=BB=A4=E8=A1=8C?= =?UTF-8?q?=E6=88=96=E5=AF=B9=E7=A8=8B=E5=BA=8F=E8=BF=9B=E8=A1=8C=E6=8E=A7?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/sample/RuntimeUtil.java | 67 +++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/main/java/sample/RuntimeUtil.java diff --git a/src/main/java/sample/RuntimeUtil.java b/src/main/java/sample/RuntimeUtil.java new file mode 100644 index 0000000..7b9e67f --- /dev/null +++ b/src/main/java/sample/RuntimeUtil.java @@ -0,0 +1,67 @@ +package sample; + +import org.apache.commons.lang3.concurrent.BasicThreadFactory; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStreamReader; +import java.lang.management.ManagementFactory; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +public class RuntimeUtil { + + + public static String exec(String command) { + StringBuilder sb = new StringBuilder(); + try { + Process process = Runtime.getRuntime().exec(command); + BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); + String line = null; + while ((line = reader.readLine()) != null) { + sb.append(line); + } + process.getOutputStream().close(); + reader.close(); + process.destroy(); + } catch (Exception e) { + System.out.println("执行外部命令错误,命令行:" + command+e); + } + return sb.toString(); + } + + private static String jps() { + return exec("jps -l"); + } + private static String getPid(){ + String name = ManagementFactory.getRuntimeMXBean().getName(); + System.out.println(name); + return name.split("@")[0]; + } + + + public static void restartApp(){ + long period = 1500; + long initialDelay = 1000; + String jpsPre = RuntimeUtil.jps(); + System.out.println(jpsPre); + ScheduledExecutorService executorService = new ScheduledThreadPoolExecutor(1, + new BasicThreadFactory.Builder().namingPattern("example-schedule-pool-%d").daemon(true).build()); + executorService.scheduleAtFixedRate(new Runnable() { + @Override + public void run() { + if (!jpsPre.equals(RuntimeUtil.jps())){ + System.out.println("关闭程序"); + System.exit(0); + } + } + },initialDelay,period, TimeUnit.MILLISECONDS); + String restartBat = CommonUtil.getFilePath()+ File.separator+"restart.bat"; + String strcmd = "cmd /c start "+restartBat; + RuntimeUtil.exec(strcmd); + } + + + +} \ No newline at end of file -- Gitee From ab45a765e42a78337410f2a928d4ca506b01269b Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 12 May 2021 09:11:22 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/pages/layout/css/stylesheet.css | 428 ++++++++++++++++++ 1 file changed, 428 insertions(+) create mode 100644 src/main/resources/pages/layout/css/stylesheet.css diff --git a/src/main/resources/pages/layout/css/stylesheet.css b/src/main/resources/pages/layout/css/stylesheet.css new file mode 100644 index 0000000..c2c1ac6 --- /dev/null +++ b/src/main/resources/pages/layout/css/stylesheet.css @@ -0,0 +1,428 @@ +/******************************************************************************* +Slate Theme for GitHub Pages +by Jason Costello, @jsncostello +*******************************************************************************/ +@import url(pygment_trac.css); + +/******************************************************************************* +MeyerWeb Reset +*******************************************************************************/ +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, + blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, + em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, + b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, + table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, + details, embed, figure, figcaption, footer, header, hgroup, menu, nav, + output, ruby, section, summary, time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font: inherit; + vertical-align: baseline; +} + +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, footer, header, hgroup, + menu, nav, section { + display: block; +} + +ol, ul { + list-style: none; +} + +table { + border-collapse: collapse; + border-spacing: 0; +} + +/******************************************************************************* +Theme Styles +*******************************************************************************/ +body { + box-sizing: border-box; + color: #000; + background: #f2f2f2; + font-size: 16px; + font-family: 'Myriad Pro', Calibri, Helvetica, Arial, sans-serif; + line-height: 1.5; + -webkit-font-smoothing: antialiased; +} +div{ + color: #000; +} +h1, h2, h3, h4, h5, h6 { + margin: 10px 0; + font-weight: 700; + color: #222222; + font-family: 'Lucida Grande', 'Calibri', Helvetica, Arial, sans-serif; + letter-spacing: -1px; +} + +h1 { + font-size: 36px; + font-weight: 700; +} + +h2 { + padding-bottom: 10px; + font-size: 32px; + background: url('../images/bg_hr.png') repeat-x bottom; +} + +h3 { + font-size: 24px; +} + +h4 { + font-size: 21px; +} + +h5 { + font-size: 18px; +} + +h6 { + font-size: 16px; +} + +p { + margin: 10px 0 15px 0; +} + +footer p { + color: #000; +} + +a { + text-decoration: none; + color: #007edf; + text-shadow: none; + transition: color 0.5s ease; + transition: text-shadow 0.5s ease; + -webkit-transition: color 0.5s ease; + -webkit-transition: text-shadow 0.5s ease; + -moz-transition: color 0.5s ease; + -moz-transition: text-shadow 0.5s ease; + -o-transition: color 0.5s ease; + -o-transition: text-shadow 0.5s ease; + -ms-transition: color 0.5s ease; + -ms-transition: text-shadow 0.5s ease; +} + +a:hover, a:focus { + text-decoration: underline; +} + +footer a { + color: #000; + text-decoration: underline; +} + +em { + font-style: italic; +} + +strong { + font-weight: bold; +} + +img { + position: relative; + margin: 0 auto; + max-width: 739px; + padding: 5px; + margin: 10px 0 10px 0; + border: 1px solid #ebebeb; + box-shadow: 0 0 5px #ebebeb; + -webkit-box-shadow: 0 0 5px #ebebeb; + -moz-box-shadow: 0 0 5px #ebebeb; + -o-box-shadow: 0 0 5px #ebebeb; + -ms-box-shadow: 0 0 5px #ebebeb; +} + +p img { + display: inline; + margin: 0; + padding: 0; + vertical-align: middle; + text-align: center; + border: none; +} + +pre, code { + width: 100%; + color: #222; + background-color: #f2f2f2; + font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", + Terminal, monospace; + font-size: 14px; + border-radius: 2px; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; +} + +pre { + width: 100%; + padding: 10px; // + box-shadow: 0 0 10px rgba(0, 0, 0, .1); + overflow: auto; +} + +code { + padding: 3px; + margin: 0 3px; // + box-shadow: 0 0 10px rgba(0, 0, 0, .1); +} + +pre code { + display: block; + box-shadow: none; +} + +blockquote { + color: #666; + margin-bottom: 20px; + padding: 0 0 0 20px; + border-left: 3px solid #bbb; +} + +ul, ol, dl { + margin-bottom: 15px +} + +ul { + list-style-position: inside; + list-style: disc; + padding-left: 20px; +} + +ol { + list-style-position: inside; + list-style: decimal; + padding-left: 20px; +} + +dl dt { + font-weight: bold; +} + +dl dd { + padding-left: 20px; + font-style: italic; +} + +dl p { + padding-left: 20px; + font-style: italic; +} + +hr { + height: 1px; + margin-bottom: 5px; + border: none; + background: url('../images/bg_hr.png') repeat-x center; +} + +table { + border: 1px solid #f2f2f2; + margin-bottom: 20px; + text-align: left; +} + +th { + font-family: 'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, + sans-serif; + padding: 10px; + background: #f2f2f2; + color: #f2f2f2; +} + +td { + padding: 10px; + border: 1px solid #f2f2f2; +} + +form { + background: #f2f2f2; + padding: 20px; +} + +.inputRow { + margin: 15px 0; +} + +.deemphasized { + opacity: .7; + font-size: .8em; + margin: 0 0 0 20px; +} + +.largeInput { + width: 500px; + font-size: 1.2em; + margin: 0 0 0 20px; +} + +/******************************************************************************* +Full-Width Styles +*******************************************************************************/ +.outer { + width: 100%; +} + +.inner { + position: relative; + max-width: 640px; + padding: 20px 10px; + margin: 0 auto; +} + +#forkme_banner { + display: block; + position: absolute; + top: 0; + right: 10px; + z-index: 10; + padding: 10px 50px 10px 10px; + color: #f2f2f2; + background: url('../images/blacktocat.png') #0090ff no-repeat 95% 50%; + font-weight: 700; + box-shadow: 0 0 10px rgba(0, 0, 0, .5); + border-bottom-left-radius: 2px; + border-bottom-right-radius: 2px; +} + +#header_wrap { + background: #f2f2f2;; + background: -moz-linear-gradient(top, #f2f2f2, #212121); + background: -webkit-linear-gradient(top, #f2f2f2, #f2f2f2); + background: -ms-linear-gradient(top, #f2f2f2, #212121); + background: -o-linear-gradient(top, #f2f2f2, #212121); + background: linear-gradient(top, #f2f2f2, #212121); +} + +#header_wrap .inner { + padding: 50px 10px 30px 10px; +} + +#project_title { + margin: 0; + color: #f2f2f2; + font-size: 42px; + font-weight: 700; + text-shadow: #111 0px 0px 10px; +} + +#project_tagline { + color: #000; + font-size: 24px; + font-weight: 300; + background: #f2f2f2; // + text-shadow: #111 0px 0px 10px; +} + +#downloads { + position: absolute; + width: 210px; + z-index: 10; + bottom: -40px; + right: 0; + height: 70px; + background: url('../images/icon_download.png') no-repeat 0% 90%; +} + +.zip_download_link { + display: block; + float: right; + width: 90px; + height: 70px; + text-indent: -5000px; + overflow: hidden; + background: url(../images/sprite_download.png) no-repeat bottom left; +} + +.tar_download_link { + display: block; + float: right; + width: 90px; + height: 70px; + text-indent: -5000px; + overflow: hidden; + background: url(../images/sprite_download.png) no-repeat bottom right; + margin-left: 10px; +} + +.zip_download_link:hover { + background: url(../images/sprite_download.png) no-repeat top left; +} + +.tar_download_link:hover { + background: url(../images/sprite_download.png) no-repeat top right; +} + +#main_content_wrap { + background: #f2f2f2; + border-top: 1px solid #f2f2f2; + border-bottom: 1px solid #f2f2f2; +} + +#main_content { + padding-top: 40px; +} + +#footer_wrap { + background: #f2f2f2; +} + +.col { + width: 50%; + float: left; +} + +/******************************************************************************* +Small Device Styles +*******************************************************************************/ +@media screen and (max-width: 480px) { + body { + font-size: 14px; + } + #downloads { + display: none; + } + .inner { + min-width: 320px; + max-width: 480px; + } + #project_title { + font-size: 32px; + } + h1 { + font-size: 28px; + } + h2 { + font-size: 24px; + } + h3 { + font-size: 21px; + } + h4 { + font-size: 18px; + } + h5 { + font-size: 14px; + } + h6 { + font-size: 12px; + } + code, pre { + min-width: 320px; + max-width: 480px; + font-size: 11px; + } + .col { + margin: 15px 0 0; + float: none; + width: 100%; + } +} \ No newline at end of file -- Gitee From 141eef8d66adafd646262f060743e5446e3dbe7a Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 12 May 2021 09:12:47 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 12449c8..e0ab38a 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ javaw -jar javafx-web-app.jar 1. 在文字输入区域数据要包含的字库,点击精简字库可以生成相应的简化ttf字库 2. 点击生成json可以生成json字库文件 - +3. 检查当前网络状态,连接到服务器自动更新程序 #### 参与贡献 1. Fork 本仓库 -- Gitee From 523024368f73f049090903f2a353519744e38641 Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 12 May 2021 09:17:14 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8C=85=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/sample/Main.java | 3 +++ src/main/java/sample/MainController.java | 2 ++ src/main/java/{sample => server}/LocalServer.java | 4 +++- src/main/java/{sample => utils}/CommonUtil.java | 4 +++- src/main/java/{sample => utils}/FontMakeUtil.java | 2 +- src/main/java/{sample => utils}/RuntimeUtil.java | 2 +- src/main/java/{sample => utils}/UpdateUtil.java | 2 +- src/main/java/{sample => utils}/WebViewUtil.java | 2 +- 8 files changed, 15 insertions(+), 6 deletions(-) rename src/main/java/{sample => server}/LocalServer.java (97%) rename src/main/java/{sample => utils}/CommonUtil.java (96%) rename src/main/java/{sample => utils}/FontMakeUtil.java (98%) rename src/main/java/{sample => utils}/RuntimeUtil.java (99%) rename src/main/java/{sample => utils}/UpdateUtil.java (99%) rename src/main/java/{sample => utils}/WebViewUtil.java (99%) diff --git a/src/main/java/sample/Main.java b/src/main/java/sample/Main.java index cd0b74c..82e802d 100644 --- a/src/main/java/sample/Main.java +++ b/src/main/java/sample/Main.java @@ -9,6 +9,9 @@ import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.stage.Stage; import ref.R; +import server.LocalServer; +import utils.RuntimeUtil; +import utils.UpdateUtil; public class Main extends Application { diff --git a/src/main/java/sample/MainController.java b/src/main/java/sample/MainController.java index 3f75e3f..0ff59a7 100644 --- a/src/main/java/sample/MainController.java +++ b/src/main/java/sample/MainController.java @@ -12,6 +12,8 @@ import javafx.scene.layout.HBox; import javafx.scene.web.WebEngine; import javafx.scene.web.WebView; import ref.R; +import utils.FontMakeUtil; +import utils.WebViewUtil; import java.io.File; import java.io.IOException; diff --git a/src/main/java/sample/LocalServer.java b/src/main/java/server/LocalServer.java similarity index 97% rename from src/main/java/sample/LocalServer.java rename to src/main/java/server/LocalServer.java index 5d4035e..7251775 100644 --- a/src/main/java/sample/LocalServer.java +++ b/src/main/java/server/LocalServer.java @@ -1,9 +1,11 @@ -package sample; +package server; import cn.hutool.http.HttpUtil; import cn.hutool.http.server.SimpleServer; import cn.hutool.json.JSONUtil; +import sample.MainController; +import utils.CommonUtil; import java.io.*; import java.nio.charset.Charset; diff --git a/src/main/java/sample/CommonUtil.java b/src/main/java/utils/CommonUtil.java similarity index 96% rename from src/main/java/sample/CommonUtil.java rename to src/main/java/utils/CommonUtil.java index 18643fe..9d18e0b 100644 --- a/src/main/java/sample/CommonUtil.java +++ b/src/main/java/utils/CommonUtil.java @@ -1,4 +1,6 @@ -package sample; +package utils; + +import sample.Main; import java.io.*; import java.nio.charset.Charset; diff --git a/src/main/java/sample/FontMakeUtil.java b/src/main/java/utils/FontMakeUtil.java similarity index 98% rename from src/main/java/sample/FontMakeUtil.java rename to src/main/java/utils/FontMakeUtil.java index 47b3fdc..8848614 100644 --- a/src/main/java/sample/FontMakeUtil.java +++ b/src/main/java/utils/FontMakeUtil.java @@ -1,4 +1,4 @@ -package sample; +package utils; import com.google.typography.font.tools.sfnttool.SfntTool; diff --git a/src/main/java/sample/RuntimeUtil.java b/src/main/java/utils/RuntimeUtil.java similarity index 99% rename from src/main/java/sample/RuntimeUtil.java rename to src/main/java/utils/RuntimeUtil.java index 7b9e67f..9bb1a7b 100644 --- a/src/main/java/sample/RuntimeUtil.java +++ b/src/main/java/utils/RuntimeUtil.java @@ -1,4 +1,4 @@ -package sample; +package utils; import org.apache.commons.lang3.concurrent.BasicThreadFactory; diff --git a/src/main/java/sample/UpdateUtil.java b/src/main/java/utils/UpdateUtil.java similarity index 99% rename from src/main/java/sample/UpdateUtil.java rename to src/main/java/utils/UpdateUtil.java index 77f9f56..dc392fc 100644 --- a/src/main/java/sample/UpdateUtil.java +++ b/src/main/java/utils/UpdateUtil.java @@ -1,4 +1,4 @@ -package sample; +package utils; import java.io.IOException; import java.io.InputStream; diff --git a/src/main/java/sample/WebViewUtil.java b/src/main/java/utils/WebViewUtil.java similarity index 99% rename from src/main/java/sample/WebViewUtil.java rename to src/main/java/utils/WebViewUtil.java index e2ef38c..cff3cf5 100644 --- a/src/main/java/sample/WebViewUtil.java +++ b/src/main/java/utils/WebViewUtil.java @@ -1,4 +1,4 @@ -package sample; +package utils; import com.mohamnag.fxwebview_debugger.DevToolsDebuggerServer; import javafx.scene.web.WebEngine; -- Gitee