parent
1361b1cb55
commit
dc5cafb06d
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Welcome to ScreenClient!</title>
|
||||
<style>
|
||||
html { color-scheme: light dark; }
|
||||
body { width: 40em; margin: 0 auto;
|
||||
font-family: Tahoma, Verdana, Arial, sans-serif; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Welcome to ScreenClient!</h1>
|
||||
<p>If you see this page, the ScreenClient server is successfully installed and
|
||||
working. Further configuration is required.</p>
|
||||
|
||||
<h4>Config</h4>
|
||||
|
||||
<p>To modify the configuration please refer to 【default.config】</p>
|
||||
|
||||
<ul>
|
||||
<li>title : Title of the application</li>
|
||||
<li>url : File path (absolute or relative) or online address, default to html/index.htm</li>
|
||||
<li>size : Default size at startup, full or normal</li>
|
||||
</ul>
|
||||
|
||||
<h4>Shortcut</h4>
|
||||
|
||||
<ul>
|
||||
<li>Esc : exit</li>
|
||||
<li>F1 : set auto start</li>
|
||||
<li>F2 : del auto start</li>
|
||||
<li>F5 : refresh</li>
|
||||
<li>F11 : full screen or normal</li>
|
||||
</ul>
|
||||
|
||||
<p><em>Thank you for using ScreenClient.</em></p>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,63 @@
|
||||
package xyz.wbsite.screen;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.log.StaticLog;
|
||||
import cn.hutool.setting.dialect.Props;
|
||||
import me.friwi.jcefmaven.CefInitializationException;
|
||||
import me.friwi.jcefmaven.UnsupportedPlatformException;
|
||||
import xyz.wbsite.screen.client.ShortCutUtil;
|
||||
import xyz.wbsite.screen.client.WebClient;
|
||||
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Starter {
|
||||
|
||||
public void run() throws InterruptedException, UnsupportedPlatformException, CefInitializationException, IOException {
|
||||
// 检查配置文件
|
||||
File configFile = new File("default.config");
|
||||
System.out.println(configFile.getAbsolutePath());
|
||||
if (!FileUtil.exist(configFile)) {
|
||||
throw new IllegalArgumentException("default.config not exist!");
|
||||
}
|
||||
// 初始化配置
|
||||
Props props = new Props(configFile);
|
||||
// 初始化客户端
|
||||
WebClient webClient = new WebClient(props);
|
||||
// 焦点事件监听
|
||||
webClient.addFocusListener(new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
StaticLog.debug("获得焦点事件");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
StaticLog.debug("丢失焦点事件");
|
||||
}
|
||||
});
|
||||
|
||||
// 添加一个鼠标点击监听
|
||||
webClient.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
StaticLog.debug("鼠标点击事件");
|
||||
}
|
||||
});
|
||||
|
||||
// 调用脚本
|
||||
webClient.executeJavaScript("console.log('java 调用 JavaScript')");
|
||||
|
||||
// 创建快捷方式使用
|
||||
File targetFile = new File("ScreenClient.exe");
|
||||
ShortCutUtil.createShortCutForDesktop(targetFile);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws InterruptedException, UnsupportedPlatformException, CefInitializationException, IOException {
|
||||
new Starter().run();
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package xyz.wbsite.screen.client;
|
||||
|
||||
public enum KeyEnum {
|
||||
|
||||
F1(112),
|
||||
F2(113),
|
||||
F3(114),
|
||||
F4(115),
|
||||
F5(116),
|
||||
F6(117),
|
||||
F7(118),
|
||||
F8(119),
|
||||
F9(120),
|
||||
F10(121),
|
||||
F11(122),
|
||||
F12(123),
|
||||
ESC(27),
|
||||
TAB(9),
|
||||
CAPSLOCK(20),
|
||||
SHIFT(16),
|
||||
CTRL(17),
|
||||
START_LEFT(91),
|
||||
START_RIGHT(92),
|
||||
CONTEXT_MENU(93),
|
||||
ALT(18),
|
||||
SPACE(32),
|
||||
CARRIAGE_RETURN(13),
|
||||
LINE_FEED(10),
|
||||
BACK_SLASH(220),
|
||||
BACK_SPACE(8),
|
||||
INSERT(45),
|
||||
DEL(46),
|
||||
HOME(36),
|
||||
END(35),
|
||||
PAGE_UP(33),
|
||||
PAGE_DOWN(34),
|
||||
PRINT_SCREEN(44),
|
||||
SCR_LK(145),
|
||||
PAUSE(19),
|
||||
LEFT_ARROW_KEY(37),
|
||||
UP_ARROW_KEY(38),
|
||||
RIGHT_ARROW_KEY(39),
|
||||
DOWN_ARROW_KEY(40),
|
||||
MOD_ALT(1),
|
||||
MOD_CONTROL(2),
|
||||
MOD_SHIFT(4),
|
||||
MOD_WIN(8);
|
||||
|
||||
private int value;
|
||||
|
||||
KeyEnum(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int value() {
|
||||
return value;
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 1.2 KiB |
Loading…
Reference in new issue