编解码工具
parent
bd25a23c40
commit
af9fde79d7
|
|
@ -0,0 +1,58 @@
|
|||
package com.zhangmeng.tools.controller;
|
||||
|
||||
import cn.hutool.core.codec.Base32;
|
||||
import cn.hutool.core.codec.Base62;
|
||||
import com.zhangmeng.tools.utils.AlertUtils;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TextField;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author : 芊芊墨客
|
||||
* @version : 1.0
|
||||
* @date : 2023-02-21 11:50
|
||||
*/
|
||||
@Slf4j
|
||||
public class Base32Controller {
|
||||
|
||||
@FXML
|
||||
private Button button;
|
||||
|
||||
@FXML
|
||||
private TextField text_filed;
|
||||
|
||||
@FXML
|
||||
private TextArea textArea1;
|
||||
|
||||
@FXML
|
||||
private Button button1;
|
||||
|
||||
@FXML
|
||||
private TextField text_filed1;
|
||||
|
||||
@FXML
|
||||
private TextArea textArea2;
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
button.setOnAction(event -> {
|
||||
String text = text_filed.getText();
|
||||
if (text.length() == 0) {
|
||||
AlertUtils.alert_warning("请输入将要转换的字符!");
|
||||
return;
|
||||
}
|
||||
textArea1.setText(Base32.encode(text));
|
||||
});
|
||||
|
||||
button1.setOnAction(event -> {
|
||||
String text = text_filed1.getText();
|
||||
if (text.length() == 0) {
|
||||
AlertUtils.alert_warning("请输入将要转换的字符!");
|
||||
return;
|
||||
}
|
||||
textArea2.setText(Base32.decodeStr(text));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
package com.zhangmeng.tools.controller;
|
||||
|
||||
import cn.hutool.core.codec.Base62;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.zhangmeng.tools.utils.AlertUtils;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TextField;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @author : 芊芊墨客
|
||||
* @version : 1.0
|
||||
* @date : 2023-02-21 11:02
|
||||
*/
|
||||
@Slf4j
|
||||
public class Base62Controller {
|
||||
|
||||
@FXML
|
||||
private Button button;
|
||||
|
||||
@FXML
|
||||
private TextField text_filed;
|
||||
|
||||
@FXML
|
||||
private TextArea textArea1;
|
||||
|
||||
@FXML
|
||||
private Button button1;
|
||||
|
||||
@FXML
|
||||
private TextField text_filed1;
|
||||
|
||||
@FXML
|
||||
private TextArea textArea2;
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
button.setOnAction(event -> {
|
||||
String text = text_filed.getText();
|
||||
if (text.length() == 0) {
|
||||
AlertUtils.alert_warning("请输入将要转换的字符!");
|
||||
return;
|
||||
}
|
||||
textArea1.setText(Base62.encode(text));
|
||||
});
|
||||
|
||||
button1.setOnAction(event -> {
|
||||
String text = text_filed1.getText();
|
||||
if (text.length() == 0) {
|
||||
AlertUtils.alert_warning("请输入将要转换的字符!");
|
||||
return;
|
||||
}
|
||||
textArea2.setText(Base62.decodeStr(text));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
package com.zhangmeng.tools.controller;
|
||||
|
||||
import cn.hutool.captcha.CaptchaUtil;
|
||||
import cn.hutool.captcha.CircleCaptcha;
|
||||
import cn.hutool.core.codec.Base62;
|
||||
import cn.hutool.core.codec.Base64;
|
||||
import com.zhangmeng.tools.utils.AlertUtils;
|
||||
import com.zhangmeng.tools.utils.ImagePath;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.stage.DirectoryChooser;
|
||||
import javafx.stage.FileChooser;
|
||||
import javafx.stage.Stage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author : 芊芊墨客
|
||||
* @version : 1.0
|
||||
* @date : 2023-02-21 11:02
|
||||
*/
|
||||
@Slf4j
|
||||
public class Base64Controller {
|
||||
|
||||
@FXML
|
||||
private Button button;
|
||||
|
||||
@FXML
|
||||
private TextField text_filed;
|
||||
|
||||
@FXML
|
||||
private TextArea textArea1;
|
||||
|
||||
@FXML
|
||||
private Button button1;
|
||||
|
||||
@FXML
|
||||
private TextField text_filed1;
|
||||
|
||||
@FXML
|
||||
private TextArea textArea2;
|
||||
|
||||
@FXML
|
||||
private Button file_choose_button;
|
||||
|
||||
@FXML
|
||||
private TextField text_file;
|
||||
|
||||
private SimpleObjectProperty<File> choose_file = new SimpleObjectProperty<>();
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
|
||||
textArea1.setWrapText(true);
|
||||
textArea2.setWrapText(true);
|
||||
|
||||
file_choose_button.setText(null);
|
||||
ImageView iv = new ImageView(new Image(ImagePath.path(ImagePath.ImagePathType.IMAGE_FILE)));
|
||||
iv.setPreserveRatio(true);
|
||||
iv.setFitWidth(18);
|
||||
file_choose_button.setGraphic(iv);
|
||||
|
||||
button.setOnAction(event -> {
|
||||
String text = text_filed.getText();
|
||||
if (text.length() == 0) {
|
||||
AlertUtils.alert_warning("请输入将要转换的字符!");
|
||||
return;
|
||||
}
|
||||
textArea1.setText(Base64.encode(text));
|
||||
});
|
||||
|
||||
button1.setOnAction(event -> {
|
||||
String text = text_filed1.getText();
|
||||
if (text.length() == 0) {
|
||||
AlertUtils.alert_warning("请输入将要转换的字符!");
|
||||
return;
|
||||
}
|
||||
textArea2.setText(Base64.decodeStr(text));
|
||||
});
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void choose_file(){
|
||||
Stage stage = (Stage) file_choose_button.getScene().getWindow();
|
||||
FileChooser dc = new FileChooser();
|
||||
dc.setTitle("文件选择");
|
||||
dc.getExtensionFilters().addAll(
|
||||
new FileChooser.ExtensionFilter("图片类型", "*.jpg", "*.png")
|
||||
);
|
||||
File file = dc.showOpenDialog(stage);
|
||||
if (file != null){
|
||||
String path = file.getAbsolutePath();
|
||||
text_file.setText(path);
|
||||
log.info("base64---file:{}" ,path);
|
||||
choose_file.set(file);
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void convert_to_base64(){
|
||||
File file = choose_file.getValue();
|
||||
if (file == null){
|
||||
AlertUtils.alert_warning("请选择图片文件!");
|
||||
}
|
||||
String encode = Base64.encode(file);
|
||||
textArea1.setText(Base64.encode(encode));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,389 @@
|
|||
package com.zhangmeng.tools.controller;
|
||||
|
||||
import com.zhangmeng.tools.utils.ImagePath;
|
||||
import com.zhangmeng.tools.utils.ResourcesUtils;
|
||||
import javafx.beans.property.SimpleDoubleProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ListCell;
|
||||
import javafx.scene.control.ListView;
|
||||
import javafx.scene.control.SplitPane;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.paint.Paint;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Callback;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author : 芊芊墨客
|
||||
* @version : 1.0
|
||||
* @date : 2023-02-21 10:29
|
||||
*/
|
||||
@Slf4j
|
||||
public class CodecToolsController {
|
||||
|
||||
private SimpleDoubleProperty width = new SimpleDoubleProperty(0.0);
|
||||
private SimpleDoubleProperty height = new SimpleDoubleProperty(0.0);
|
||||
private AnchorPane root;
|
||||
|
||||
private AnchorPane hex_16;
|
||||
private AnchorPane unicode;
|
||||
private AnchorPane jwt_web;
|
||||
private AnchorPane color_choose;
|
||||
private AnchorPane base_62;
|
||||
private AnchorPane base_64;
|
||||
private AnchorPane base_32;
|
||||
private AnchorPane morse_coder;
|
||||
|
||||
@FXML
|
||||
private ListView<ResourcesUtils.CodecTools> listView;
|
||||
|
||||
@FXML
|
||||
private SplitPane splitPane;
|
||||
|
||||
public static final String color_cell = "#f4f4f4";
|
||||
|
||||
@FXML
|
||||
public void md5_menu_item() {
|
||||
load_encrypt();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void spring_security_menu_item() {
|
||||
load_encrypt();
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void video_menu_item() {
|
||||
load_player(0);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void music_menu_item() {
|
||||
load_player(1);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void vip_parser_menu_item() {
|
||||
load_player(2);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void unicode_menu_item(){
|
||||
load_small_tools(1);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void jwt_menu_item(){
|
||||
load_small_tools(2);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void hex_16_menu_item(){
|
||||
load_small_tools(0);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void color_choose_menu_item(){
|
||||
|
||||
load_small_tools(3);
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
public void base_62_menu_item(){
|
||||
|
||||
boolean flag = false;
|
||||
if (base_62 != null){
|
||||
flag = true;
|
||||
}
|
||||
base_62(flag);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void base_64_menu_item(){
|
||||
|
||||
boolean flag = false;
|
||||
if (base_64 != null){
|
||||
flag = true;
|
||||
}
|
||||
base_64(flag);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void base_32_menu_item(){
|
||||
|
||||
boolean flag = false;
|
||||
if (base_32 != null){
|
||||
flag = true;
|
||||
}
|
||||
base_32(flag);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void morse_coder_menu_item(){
|
||||
|
||||
boolean flag = false;
|
||||
if (morse_coder != null){
|
||||
flag = true;
|
||||
}
|
||||
morse_coder(flag);
|
||||
}
|
||||
|
||||
public void load_small_tools(int index) {
|
||||
AnchorPane fx = null;
|
||||
try {
|
||||
fx = FXMLLoader.load(ResourcesUtils.getResource("small-tools"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Scene scene = new Scene(fx);
|
||||
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||
stage.setScene(scene);
|
||||
|
||||
ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||
listView.getSelectionModel().select(index);
|
||||
}
|
||||
|
||||
public void load_player(int index) {
|
||||
AnchorPane fx = null;
|
||||
try {
|
||||
fx = FXMLLoader.load(ResourcesUtils.getResource("player"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Scene scene = new Scene(fx);
|
||||
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||
stage.setScene(scene);
|
||||
|
||||
ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||
listView.getSelectionModel().select(index);
|
||||
}
|
||||
|
||||
public void load_encrypt() {
|
||||
|
||||
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||
|
||||
AnchorPane fx = null;
|
||||
try {
|
||||
fx = FXMLLoader.load(ResourcesUtils.getResource("home"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Scene scene = new Scene(fx);
|
||||
stage.setScene(scene);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
init();
|
||||
listView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue != null) {
|
||||
boolean flag = false;
|
||||
if (newValue.getIndex() == 0) {
|
||||
if (base_62 != null) {
|
||||
flag = true;
|
||||
}
|
||||
base_62(flag);
|
||||
}
|
||||
if (newValue.getIndex() == 1) {
|
||||
if (base_64 != null) {
|
||||
flag = true;
|
||||
}
|
||||
base_64(flag);
|
||||
}
|
||||
|
||||
if (newValue.getIndex() == 2) {
|
||||
if (base_32 != null) {
|
||||
flag = true;
|
||||
}
|
||||
base_32(flag);
|
||||
}
|
||||
|
||||
if (newValue.getIndex() == 3) {
|
||||
if (morse_coder != null) {
|
||||
flag = true;
|
||||
}
|
||||
morse_coder(flag);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static Image getImage(ResourcesUtils.CodecTools codecTools) {
|
||||
return switch (codecTools) {
|
||||
case Base62 -> new Image(ImagePath.path(ImagePath.ImagePathType.Hex_16));
|
||||
case Base64 -> new Image(ImagePath.path(ImagePath.ImagePathType.Unicode));
|
||||
case Base32 -> new Image(ImagePath.path(ImagePath.ImagePathType.JWT_WEB));
|
||||
case MorseCoder -> new Image(ImagePath.path(ImagePath.ImagePathType.COLOR_CHOOSE));
|
||||
};
|
||||
}
|
||||
|
||||
public void init() {
|
||||
ResourcesUtils.CodecTools[] values = ResourcesUtils.CodecTools.values();
|
||||
ObservableList<ResourcesUtils.CodecTools> list = FXCollections.observableArrayList();
|
||||
list.addAll(Arrays.asList(values));
|
||||
listView.setItems(list);
|
||||
listView.setFixedCellSize(40);
|
||||
listView.setCellFactory(new Callback<>() {
|
||||
|
||||
private int position;
|
||||
|
||||
@Override
|
||||
public ListCell<ResourcesUtils.CodecTools> call(ListView<ResourcesUtils.CodecTools> SmallToolsListView) {
|
||||
|
||||
Label label = new Label();
|
||||
label.setPrefWidth(200);
|
||||
ListCell<ResourcesUtils.CodecTools> listCell = new ListCell<>() {
|
||||
@Override
|
||||
protected void updateItem(ResourcesUtils.CodecTools codecTools, boolean b) {
|
||||
super.updateItem(codecTools, b);
|
||||
if (!b) {
|
||||
HBox hBox = new HBox(30);
|
||||
hBox.setAlignment(Pos.CENTER);
|
||||
label.setText(codecTools.getTitle());
|
||||
label.setTextFill(Paint.valueOf("#000000"));
|
||||
Image im = getImage(codecTools);
|
||||
ImageView iv = new ImageView(im);
|
||||
iv.setPreserveRatio(true);
|
||||
iv.setFitWidth(15);
|
||||
hBox.getChildren().add(iv);
|
||||
hBox.getChildren().add(label);
|
||||
this.setGraphic(hBox);
|
||||
}
|
||||
this.setStyle("-fx-background-color: " + color_cell);
|
||||
}
|
||||
};
|
||||
|
||||
listCell.hoverProperty().addListener((observableValue, aBoolean, t1) -> {
|
||||
if (t1 && !label.getText().equals("")) {
|
||||
position = SmallToolsListView.getItems().indexOf(label.getText());
|
||||
label.setFont(new Font(16));
|
||||
SmallToolsListView.getFocusModel().focus(position);
|
||||
listCell.setStyle("-fx-background-color: #369e7d");
|
||||
} else {
|
||||
label.setPrefHeight(20);
|
||||
label.setFont(new Font(13));
|
||||
listCell.setStyle("-fx-background-color: " + color_cell);
|
||||
}
|
||||
});
|
||||
|
||||
return listCell;
|
||||
}
|
||||
});
|
||||
base_62(false);
|
||||
}
|
||||
|
||||
public void base_62(boolean flag){
|
||||
//默认选择第一个
|
||||
listView.getSelectionModel().select(0);
|
||||
|
||||
if (!flag) {
|
||||
try {
|
||||
root = FXMLLoader.load(ResourcesUtils.getResource("base-62"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
base_62 = root;
|
||||
} else {
|
||||
root = base_62;
|
||||
}
|
||||
common_method();
|
||||
}
|
||||
|
||||
public void base_64(boolean flag){
|
||||
//默认选择第一个
|
||||
listView.getSelectionModel().select(1);
|
||||
|
||||
if (!flag) {
|
||||
try {
|
||||
root = FXMLLoader.load(ResourcesUtils.getResource("base-64"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
base_64 = root;
|
||||
} else {
|
||||
root = base_64;
|
||||
}
|
||||
common_method();
|
||||
}
|
||||
|
||||
public void base_32(boolean flag){
|
||||
//默认选择第一个
|
||||
listView.getSelectionModel().select(2);
|
||||
|
||||
if (!flag) {
|
||||
try {
|
||||
root = FXMLLoader.load(ResourcesUtils.getResource("base-32"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
base_32 = root;
|
||||
} else {
|
||||
root = base_32;
|
||||
}
|
||||
common_method();
|
||||
}
|
||||
|
||||
public void morse_coder(boolean flag){
|
||||
//默认选择第一个
|
||||
listView.getSelectionModel().select(3);
|
||||
|
||||
if (!flag) {
|
||||
try {
|
||||
root = FXMLLoader.load(ResourcesUtils.getResource("morse-coder"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
morse_coder = root;
|
||||
} else {
|
||||
root = morse_coder;
|
||||
}
|
||||
common_method();
|
||||
}
|
||||
|
||||
private void common_method() {
|
||||
splitPane.getItems().remove(1);
|
||||
splitPane.getItems().add(1, root);
|
||||
root.widthProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue != null) {
|
||||
double width = splitPane.getWidth();
|
||||
CodecToolsController.this.width.set(width);
|
||||
log.info("SmallTools:--->width:{}", width);
|
||||
}
|
||||
});
|
||||
root.heightProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue != null) {
|
||||
double height = splitPane.getHeight();
|
||||
CodecToolsController.this.height.set(height);
|
||||
log.info("SmallTools:--->height:{}", height);
|
||||
}
|
||||
});
|
||||
|
||||
this.width.addListener((observable, oldValue, newValue) -> {
|
||||
CodecToolsController.this.root.setPrefWidth(newValue.doubleValue() - listView.getWidth());
|
||||
log.info("newValue.doubleValue():{}", newValue.doubleValue());
|
||||
});
|
||||
|
||||
this.height.addListener((observable, oldValue, newValue) -> {
|
||||
CodecToolsController.this.root.setPrefHeight(newValue.doubleValue() - listView.getHeight());
|
||||
log.info("newValue.doubleValue():{}", newValue.doubleValue());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -109,6 +109,42 @@ public class HomeController implements Serializable {
|
|||
load_small_tools(3);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void base_62_menu_item(){
|
||||
load_codec_tools(0);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void base_64_menu_item(){
|
||||
load_codec_tools(1);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void base_32_menu_item(){
|
||||
load_codec_tools(2);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void morse_coder_menu_item(){
|
||||
load_codec_tools(3);
|
||||
}
|
||||
|
||||
public void load_codec_tools(int index){
|
||||
AnchorPane fx = null;
|
||||
try {
|
||||
fx = FXMLLoader.load(ResourcesUtils.getResource("codec-tools"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Scene scene = new Scene(fx);
|
||||
Stage stage = (Stage) splitPane.getScene().getWindow();
|
||||
stage.setScene(scene);
|
||||
|
||||
ListView<ResourcesUtils.Player> listView = (ListView) fx.lookup("#listView");
|
||||
listView.getSelectionModel().select(index);
|
||||
}
|
||||
|
||||
public void load_small_tools(int index){
|
||||
AnchorPane fx = null;
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package com.zhangmeng.tools.controller;
|
||||
|
||||
import cn.hutool.core.codec.Base32;
|
||||
import cn.hutool.core.codec.Morse;
|
||||
import com.zhangmeng.tools.utils.AlertUtils;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TextField;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* @author : 芊芊墨客
|
||||
* @version : 1.0
|
||||
* @date : 2023-02-21 11:57
|
||||
*/
|
||||
@Slf4j
|
||||
public class MorseCoderController {
|
||||
|
||||
@FXML
|
||||
private Button button;
|
||||
|
||||
@FXML
|
||||
private TextField text_filed;
|
||||
|
||||
@FXML
|
||||
private TextArea textArea1;
|
||||
|
||||
@FXML
|
||||
private Button button1;
|
||||
|
||||
@FXML
|
||||
private TextField text_filed1;
|
||||
|
||||
@FXML
|
||||
private TextArea textArea2;
|
||||
|
||||
private final Morse morseCoder = new Morse();
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
button.setOnAction(event -> {
|
||||
String text = text_filed.getText();
|
||||
if (text.length() == 0) {
|
||||
AlertUtils.alert_warning("请输入将要转换的字符!");
|
||||
return;
|
||||
}
|
||||
textArea1.setText(morseCoder.encode(text));
|
||||
});
|
||||
|
||||
button1.setOnAction(event -> {
|
||||
String text = text_filed1.getText();
|
||||
if (text.length() == 0) {
|
||||
AlertUtils.alert_warning("请输入将要转换的字符!");
|
||||
return;
|
||||
}
|
||||
textArea2.setText(morseCoder.decode(text));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -110,4 +110,37 @@ public class ResourcesUtils {
|
|||
private String title;
|
||||
private int index;
|
||||
}
|
||||
|
||||
public enum CodecTools{
|
||||
|
||||
Base62("Base62编码解码",0),
|
||||
Base64("Base64编码解码",1),
|
||||
Base32("Base32编码解码",2),
|
||||
MorseCoder ("摩尔斯电码",3),
|
||||
;
|
||||
|
||||
CodecTools(String title, int index) {
|
||||
this.title = title;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public void setIndex(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
private String title;
|
||||
private int index;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Separator?>
|
||||
<?import javafx.scene.control.TextArea?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
|
||||
<AnchorPane prefHeight="649.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.tools.controller.Base32Controller">
|
||||
<children>
|
||||
<Label layoutX="169.0" layoutY="102.0" text="普通字符串:" AnchorPane.leftAnchor="169.0" />
|
||||
<TextField fx:id="text_filed" layoutX="300.0" layoutY="98.0" prefHeight="25.0" prefWidth="619.0" AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="281.0" AnchorPane.topAnchor="98.0" />
|
||||
<Button fx:id="button" layoutX="930.0" layoutY="98.0" mnemonicParsing="false" text="转换" AnchorPane.rightAnchor="230.0" />
|
||||
<Label layoutX="169.0" layoutY="160.0" text="base32字符:" />
|
||||
<TextArea fx:id="textArea1" layoutX="300.0" layoutY="160.0" prefHeight="121.0" prefWidth="619.0" AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="281.0" AnchorPane.topAnchor="160.0" />
|
||||
<Label layoutX="169.0" layoutY="369.0" text="base32字符:" AnchorPane.leftAnchor="169.0" AnchorPane.rightAnchor="918.0" />
|
||||
<Separator layoutX="56.0" layoutY="317.0" prefHeight="5.0" prefWidth="1200.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||
<TextField fx:id="text_filed1" layoutX="300.0" layoutY="365.0" prefHeight="25.0" prefWidth="619.0" AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="281.0" />
|
||||
<Button fx:id="button1" layoutX="930.0" layoutY="365.0" mnemonicParsing="false" text="转换" AnchorPane.rightAnchor="230.0" />
|
||||
<TextArea fx:id="textArea2" layoutX="300.0" layoutY="429.0" prefHeight="121.0" prefWidth="619.0" AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="281.0" />
|
||||
<Label layoutX="169.0" layoutY="429.0" text="普通字符串:" AnchorPane.leftAnchor="169.0" AnchorPane.rightAnchor="918.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Separator?>
|
||||
<?import javafx.scene.control.TextArea?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
|
||||
<AnchorPane prefHeight="649.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.tools.controller.Base62Controller">
|
||||
<children>
|
||||
<Label layoutX="169.0" layoutY="102.0" text="普通字符串:" AnchorPane.leftAnchor="169.0" />
|
||||
<TextField fx:id="text_filed" layoutX="300.0" layoutY="98.0" prefHeight="25.0" prefWidth="619.0" AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="281.0" AnchorPane.topAnchor="98.0" />
|
||||
<Button fx:id="button" layoutX="930.0" layoutY="98.0" mnemonicParsing="false" text="转换" AnchorPane.rightAnchor="230.0" />
|
||||
<Label layoutX="169.0" layoutY="160.0" text="base62字符:" />
|
||||
<TextArea fx:id="textArea1" layoutX="300.0" layoutY="160.0" prefHeight="121.0" prefWidth="619.0" AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="281.0" AnchorPane.topAnchor="160.0" />
|
||||
<Label layoutX="169.0" layoutY="369.0" text="base62字符:" AnchorPane.leftAnchor="169.0" AnchorPane.rightAnchor="918.0" />
|
||||
<Separator layoutX="56.0" layoutY="317.0" prefHeight="5.0" prefWidth="1200.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||
<TextField fx:id="text_filed1" layoutX="300.0" layoutY="365.0" prefHeight="25.0" prefWidth="619.0" AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="281.0" />
|
||||
<Button fx:id="button1" layoutX="930.0" layoutY="365.0" mnemonicParsing="false" text="转换" AnchorPane.rightAnchor="230.0" />
|
||||
<TextArea fx:id="textArea2" layoutX="300.0" layoutY="429.0" prefHeight="121.0" prefWidth="619.0" AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="281.0" />
|
||||
<Label layoutX="169.0" layoutY="429.0" text="普通字符串:" AnchorPane.leftAnchor="169.0" AnchorPane.rightAnchor="918.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Separator?>
|
||||
<?import javafx.scene.control.TextArea?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
|
||||
<AnchorPane prefHeight="649.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/19"
|
||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.tools.controller.Base64Controller">
|
||||
<children>
|
||||
<Label layoutX="169.0" layoutY="102.0" text="普通字符串:" AnchorPane.leftAnchor="169.0"/>
|
||||
<TextField fx:id="text_filed" layoutX="300.0" layoutY="98.0" prefHeight="25.0" prefWidth="270.0"
|
||||
AnchorPane.leftAnchor="300.0" AnchorPane.topAnchor="98.0"/>
|
||||
<Button fx:id="button" layoutX="600.0" layoutY="98.0" mnemonicParsing="false" text="转换"
|
||||
AnchorPane.leftAnchor="600.0"/>
|
||||
<Label layoutX="169.0" layoutY="160.0" text="base64字符:"/>
|
||||
<TextArea fx:id="textArea1" layoutX="300.0" layoutY="160.0" prefHeight="121.0" prefWidth="619.0"
|
||||
AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="281.0" AnchorPane.topAnchor="160.0"/>
|
||||
<Label layoutX="169.0" layoutY="369.0" text="base64字符:" AnchorPane.leftAnchor="169.0"
|
||||
AnchorPane.rightAnchor="918.0"/>
|
||||
<Separator layoutX="56.0" layoutY="317.0" prefHeight="5.0" prefWidth="1200.0" AnchorPane.leftAnchor="0.0"
|
||||
AnchorPane.rightAnchor="0.0"/>
|
||||
<TextField fx:id="text_filed1" layoutX="300.0" layoutY="365.0" prefHeight="25.0" prefWidth="619.0"
|
||||
AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="281.0"/>
|
||||
<Button fx:id="button1" layoutX="930.0" layoutY="365.0" mnemonicParsing="false" text="转换"
|
||||
AnchorPane.rightAnchor="230.0"/>
|
||||
<TextArea fx:id="textArea2" layoutX="300.0" layoutY="429.0" prefHeight="121.0" prefWidth="619.0"
|
||||
AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="281.0"/>
|
||||
<Label layoutX="169.0" layoutY="429.0" text="普通字符串:" AnchorPane.leftAnchor="169.0"
|
||||
AnchorPane.rightAnchor="918.0"/>
|
||||
<TextField layoutX="758.0" layoutY="98.0" AnchorPane.rightAnchor="281.0" fx:id="text_file"/>
|
||||
<Button layoutX="930.0" layoutY="98.0" mnemonicParsing="false" text="转换" AnchorPane.rightAnchor="230.0" onAction="#convert_to_base64"/>
|
||||
<Button layoutX="691.0" layoutY="98.0" mnemonicParsing="false" text="图片" AnchorPane.rightAnchor="454.0"
|
||||
fx:id="file_choose_button" onAction="#choose_file"/>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.ListView?>
|
||||
<?import javafx.scene.control.Menu?>
|
||||
<?import javafx.scene.control.MenuBar?>
|
||||
<?import javafx.scene.control.MenuItem?>
|
||||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
|
||||
<AnchorPane prefHeight="800.0" prefWidth="1661.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.tools.controller.CodecToolsController">
|
||||
<children>
|
||||
<MenuBar layoutX="14.0" layoutY="27.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="0.0">
|
||||
<menus>
|
||||
|
||||
<Menu mnemonicParsing="false" text="加密工具">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" onAction="#md5_menu_item" text="md5 加密"/>
|
||||
<MenuItem mnemonicParsing="false" onAction="#spring_security_menu_item"
|
||||
text="spring security 加密"/>
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="影音工具">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="视频播放" onAction="#video_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="音乐播放" onAction="#music_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="vip 视频解析" onAction="#vip_parser_menu_item"/>
|
||||
</items>
|
||||
</Menu>
|
||||
<Menu mnemonicParsing="false" text="常用小工具">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="16进制(Hex)" onAction="#hex_16_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="Unicode和字符串转换" onAction="#unicode_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="jwt工具" onAction="#jwt_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="颜色选择工具" onAction="#color_choose_menu_item"/>
|
||||
</items>
|
||||
</Menu>
|
||||
|
||||
<Menu mnemonicParsing="false" text="编解码工具">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="Base62编码解码" onAction="#base_62_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="Base64编码解码" onAction="#base_64_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="Base32编码解码" onAction="#base_32_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="摩尔斯电码" onAction="#morse_coder_menu_item"/>
|
||||
</items>
|
||||
</Menu>
|
||||
</menus>
|
||||
</MenuBar>
|
||||
<SplitPane fx:id="splitPane" dividerPositions="0.5" layoutY="25.0" prefHeight="575.0" prefWidth="1200.0"
|
||||
AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="25.0">
|
||||
<items>
|
||||
<ListView fx:id="listView" maxWidth="300.0" minWidth="200.0" prefHeight="200.0" prefWidth="200.0"/>
|
||||
<AnchorPane prefHeight="200.0" prefWidth="200.0"/>
|
||||
</items>
|
||||
</SplitPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0"
|
||||
<AnchorPane prefHeight="800.0"
|
||||
prefWidth="1661.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.zhangmeng.tools.controller.HomeController">
|
||||
<children>
|
||||
|
|
@ -36,6 +36,15 @@
|
|||
<MenuItem mnemonicParsing="false" text="颜色选择工具" onAction="#color_choose_menu_item"/>
|
||||
</items>
|
||||
</Menu>
|
||||
|
||||
<Menu mnemonicParsing="false" text="编解码工具">
|
||||
<items>
|
||||
<MenuItem mnemonicParsing="false" text="Base62编码解码" onAction="#base_62_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="Base64编码解码" onAction="#base_64_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="Base32编码解码" onAction="#base_32_menu_item"/>
|
||||
<MenuItem mnemonicParsing="false" text="摩尔斯电码" onAction="#morse_coder_menu_item"/>
|
||||
</items>
|
||||
</Menu>
|
||||
</menus>
|
||||
</MenuBar>
|
||||
<SplitPane fx:id="splitPane" dividerPositions="0.5" layoutY="25.0" prefHeight="575.0" prefWidth="1200.0"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.Separator?>
|
||||
<?import javafx.scene.control.TextArea?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
|
||||
<AnchorPane prefHeight="649.0" prefWidth="1200.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.tools.controller.MorseCoderController">
|
||||
<children>
|
||||
<Label layoutX="169.0" layoutY="102.0" text="普通字符串:" AnchorPane.leftAnchor="169.0" />
|
||||
<TextField fx:id="text_filed" layoutX="300.0" layoutY="98.0" prefHeight="25.0" prefWidth="619.0" AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="281.0" AnchorPane.topAnchor="98.0" />
|
||||
<Button fx:id="button" layoutX="930.0" layoutY="98.0" mnemonicParsing="false" text="转换" AnchorPane.rightAnchor="230.0" />
|
||||
<Label layoutX="169.0" layoutY="160.0" text="morse字符:" />
|
||||
<TextArea fx:id="textArea1" layoutX="300.0" layoutY="160.0" prefHeight="121.0" prefWidth="619.0" AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="281.0" AnchorPane.topAnchor="160.0" />
|
||||
<Label layoutX="169.0" layoutY="369.0" text="morse字符:" AnchorPane.leftAnchor="169.0" AnchorPane.rightAnchor="918.0" />
|
||||
<Separator layoutX="56.0" layoutY="317.0" prefHeight="5.0" prefWidth="1200.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
|
||||
<TextField fx:id="text_filed1" layoutX="300.0" layoutY="365.0" prefHeight="25.0" prefWidth="619.0" AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="281.0" />
|
||||
<Button fx:id="button1" layoutX="930.0" layoutY="365.0" mnemonicParsing="false" text="转换" AnchorPane.rightAnchor="230.0" />
|
||||
<TextArea fx:id="textArea2" layoutX="300.0" layoutY="429.0" prefHeight="121.0" prefWidth="619.0" AnchorPane.leftAnchor="300.0" AnchorPane.rightAnchor="281.0" />
|
||||
<Label layoutX="169.0" layoutY="429.0" text="普通字符串:" AnchorPane.leftAnchor="169.0" AnchorPane.rightAnchor="918.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
||||
|
||||
|
|
@ -7,9 +7,7 @@
|
|||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0"
|
||||
prefWidth="1661.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.zhangmeng.tools.controller.PlayerController">
|
||||
<AnchorPane prefHeight="800.0" prefWidth="1661.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.tools.controller.PlayerController">
|
||||
<children>
|
||||
<MenuBar layoutX="14.0" layoutY="27.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="0.0">
|
||||
|
|
|
|||
|
|
@ -7,9 +7,7 @@
|
|||
<?import javafx.scene.control.SplitPane?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="800.0"
|
||||
prefWidth="1661.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.zhangmeng.tools.controller.SmallToolsController">
|
||||
<AnchorPane prefHeight="800.0" prefWidth="1661.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.zhangmeng.tools.controller.SmallToolsController">
|
||||
<children>
|
||||
<MenuBar layoutX="14.0" layoutY="27.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0"
|
||||
AnchorPane.topAnchor="0.0">
|
||||
|
|
|
|||
Loading…
Reference in New Issue