MCPcopy Create free account
hub / github.com/CharlieJiang/SourceCodeDocxGenerator / ParamsWindow

Class ParamsWindow

src/main/java/cocoas/ParamsWindow.java:18–222  ·  view source on GitHub ↗

描述:获取源代码文档生成参数的可视化页面 作者:蒋庆意 日期时间:2021/1/20 16:37 cocoasjiang@foxmail.com

Source from the content-addressed store, hash-verified

16 * cocoasjiang@foxmail.com
17 */
18public class ParamsWindow {
19
20 private static boolean isHalf = false;// 文档是否分为前后各30页
21 private static String dirPath = "";// 项目路径
22 private static String[] params;// 参数数组
23 private List<String> ignoreDirs;// 需要扫描时忽略的文件夹
24
25 public ParamsWindow(){
26 createParamsWindow();
27 }
28
29 public static void main(String[] args) {
30 new ParamsWindow();
31 }
32
33 /**
34 * 创建参数输入窗口
35 */
36 private void createParamsWindow(){
37 JFrame window = new JFrame();
38 window.setTitle("源代码文档自动生成工具");// 窗口标题
39 JPanel panel = new JPanel();// 总容器
40
41 /*##必填部分##*/
42 // 必填部分标题
43 JLabel labelForceTitle = new JLabel("--------必填部分--------");
44 labelForceTitle.setForeground(Color.red);
45 // 源代码项目目录
46 JPanel panelDir = new JPanel();// 项目目录容器
47 JLabel labelDir = new JLabel("项目目录:");
48 JTextField inputDir = new JTextField();
49 Dimension inputSize = new Dimension(200,30);// 输入框尺寸
50 inputDir.setPreferredSize(inputSize);
51 JButton btnDir = new JButton("选择");
52 btnDir.addActionListener(new ActionListener() {
53 @Override
54 public void actionPerformed(ActionEvent e) {
55 // 创建文件选择器
56 JFileChooser fileChooser = new JFileChooser("C:\\");
57 // 设置只选择文件夹
58 fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
59 int result = fileChooser.showOpenDialog(null);
60 if(result == JFileChooser.APPROVE_OPTION){
61 File selectedDir = fileChooser.getSelectedFile();
62 dirPath = selectedDir.getAbsolutePath();
63 LogUtils.println("选择文件夹:" + dirPath);
64 inputDir.setText(dirPath);
65 }else{
66 LogUtils.println("未选择文件夹");
67 }
68 }
69 });
70 panelDir.add(labelDir);
71 panelDir.add(inputDir);
72 panelDir.add(btnDir);
73 // 写入方式
74 JPanel panelType = new JPanel();// 写入方式容器
75 JLabel labelType = new JLabel("写入方式:");

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected