Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 81e6d17

Browse files
committed
add springframework
1 parent b3e6ed2 commit 81e6d17

File tree

2 files changed

+215
-11
lines changed

2 files changed

+215
-11
lines changed

pom.xml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<name>DictSystemInJava</name>
4242

4343
<properties>
44+
<spring.version>4.3.9.RELEASE</spring.version>
4445
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4546
<junit.version>5.11.2</junit.version>
4647
<maven.compiler.source>20</maven.compiler.source>
@@ -79,6 +80,106 @@
7980
<artifactId>jcurand</artifactId>
8081
<version>11.6.1</version>
8182
</dependency>
83+
<dependency>
84+
<groupId>org.springframework</groupId>
85+
<artifactId>spring-aop</artifactId>
86+
<version>${spring.version}</version>
87+
</dependency>
88+
<dependency>
89+
<groupId>org.springframework</groupId>
90+
<artifactId>spring-aspects</artifactId>
91+
<version>${spring.version}</version>
92+
</dependency>
93+
<dependency>
94+
<groupId>org.springframework</groupId>
95+
<artifactId>spring-beans</artifactId>
96+
<version>${spring.version}</version>
97+
</dependency>
98+
<dependency>
99+
<groupId>org.springframework</groupId>
100+
<artifactId>spring-context</artifactId>
101+
<version>${spring.version}</version>
102+
</dependency>
103+
<dependency>
104+
<groupId>org.springframework</groupId>
105+
<artifactId>spring-context-support</artifactId>
106+
<version>${spring.version}</version>
107+
</dependency>
108+
<dependency>
109+
<groupId>org.springframework</groupId>
110+
<artifactId>spring-core</artifactId>
111+
<version>${spring.version}</version>
112+
</dependency>
113+
<dependency>
114+
<groupId>org.springframework</groupId>
115+
<artifactId>spring-expression</artifactId>
116+
<version>${spring.version}</version>
117+
</dependency>
118+
<dependency>
119+
<groupId>org.springframework</groupId>
120+
<artifactId>spring-instrument</artifactId>
121+
<version>${spring.version}</version>
122+
</dependency>
123+
<dependency>
124+
<groupId>org.springframework</groupId>
125+
<artifactId>spring-instrument-tomcat</artifactId>
126+
<version>${spring.version}</version>
127+
</dependency>
128+
<dependency>
129+
<groupId>org.springframework</groupId>
130+
<artifactId>spring-jdbc</artifactId>
131+
<version>${spring.version}</version>
132+
</dependency>
133+
<dependency>
134+
<groupId>org.springframework</groupId>
135+
<artifactId>spring-jms</artifactId>
136+
<version>${spring.version}</version>
137+
</dependency>
138+
<dependency>
139+
<groupId>org.springframework</groupId>
140+
<artifactId>spring-messaging</artifactId>
141+
<version>${spring.version}</version>
142+
</dependency>
143+
<dependency>
144+
<groupId>org.springframework</groupId>
145+
<artifactId>spring-orm</artifactId>
146+
<version>${spring.version}</version>
147+
</dependency>
148+
<dependency>
149+
<groupId>org.springframework</groupId>
150+
<artifactId>spring-oxm</artifactId>
151+
<version>${spring.version}</version>
152+
</dependency>
153+
<dependency>
154+
<groupId>org.springframework</groupId>
155+
<artifactId>spring-test</artifactId>
156+
<version>${spring.version}</version>
157+
</dependency>
158+
<dependency>
159+
<groupId>org.springframework</groupId>
160+
<artifactId>spring-tx</artifactId>
161+
<version>${spring.version}</version>
162+
</dependency>
163+
<dependency>
164+
<groupId>org.springframework</groupId>
165+
<artifactId>spring-web</artifactId>
166+
<version>${spring.version}</version>
167+
</dependency>
168+
<dependency>
169+
<groupId>org.springframework</groupId>
170+
<artifactId>spring-webmvc</artifactId>
171+
<version>${spring.version}</version>
172+
</dependency>
173+
<dependency>
174+
<groupId>org.springframework</groupId>
175+
<artifactId>spring-webmvc-portlet</artifactId>
176+
<version>${spring.version}</version>
177+
</dependency>
178+
<dependency>
179+
<groupId>org.springframework</groupId>
180+
<artifactId>spring-websocket</artifactId>
181+
<version>${spring.version}</version>
182+
</dependency>
82183
<dependency>
83184
<groupId>org.jcuda</groupId>
84185
<artifactId>jcudnn</artifactId>

src/main/java/top/mryan2005/managesysteminjava/BasicClass/Entry.java

Lines changed: 114 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
import org.apache.commons.codec.binary.Base64;
44
import org.apache.commons.codec.digest.DigestUtils;
5-
5+
import org.springframework.util.DigestUtils;
66
import javax.swing.*;
7+
import javax.swing.table.TableColumn;
78
import java.awt.*;
89
import java.awt.event.ActionEvent;
910
import java.awt.event.ActionListener;
11+
import java.io.UnsupportedEncodingException;
1012
import java.util.ArrayList;
1113

1214
public class Entry {
@@ -39,7 +41,7 @@ public String generateHTML() {
3941
"</head><body>" +
4042
"<h1>" + simplified_Chinese_character + "</h1>" +
4143
"<h2>" + traditional_Chinese_character + "</h2>" +
42-
"<p>词组:" + phrases + "</p>" +
44+
// "<p>词组:" + phrases + "</p>" +
4345
"<p>梧州话发音:" + Pronunciation_of_Wuzhou + "</p>" +
4446
"<p>苍梧石桥话发音:" + Pronunciation_of_Cangwu_Shiqiao + "</p>" +
4547
"<p>蒙山话发音:" + Pronunciation_of_Mengshan + "</p>" +
@@ -62,13 +64,13 @@ public String generateHTML() {
6264
return html;
6365
}
6466

65-
public String generateCurrentHash() {
67+
public String generateCurrentHash() throws UnsupportedEncodingException {
6668
Base64 base64 = new Base64();
67-
currentHash = DigestUtils.md5Hex(base64.encode(html.getBytes()));
69+
currentHash = DigestUtils.md5DigestAsHex(html.getBytes("GBK"));
6870
return currentHash;
6971
}
7072

71-
public static void main(String[] args) {
73+
public static void main(String[] args) throws UnsupportedEncodingException {
7274
Entry entry = new Entry();
7375
entry.simplified_Chinese_character = "你";
7476
entry.traditional_Chinese_character = "你";
@@ -86,14 +88,93 @@ public static void main(String[] args) {
8688
entry.Contributors = new ArrayList<>();
8789
entry.Contributors.add("mryan2005");
8890
entry.Contributors.add("gungbbogedding");
89-
JFrame frame = new JFrame();
90-
frame.setSize(800, 600);
91-
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
91+
entry.viewEntry(entry);
92+
}
93+
94+
public void viewEntry(Entry entry) throws UnsupportedEncodingException {
95+
JFrame jDialog = new JFrame();
96+
jDialog.setSize(800, 600);
97+
jDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
98+
jDialog.setLayout(new FlowLayout());
99+
entry.generateHTML();
100+
entry.generateCurrentHash();
101+
JLabel jLabel = new JLabel(entry.generateHTML());
102+
jDialog.add(jLabel);
103+
JButton jButton = new JButton("编辑");
104+
jDialog.add(jButton);
105+
jButton.addActionListener(new ActionListener() {
106+
@Override
107+
public void actionPerformed(ActionEvent e) {
108+
editEntry(jDialog);
109+
entry.generateHTML();
110+
try {
111+
entry.generateCurrentHash();
112+
} catch (UnsupportedEncodingException ex) {
113+
throw new RuntimeException(ex);
114+
}
115+
jLabel.setText(entry.generateHTML());
116+
jLabel.paintImmediately(jLabel.getVisibleRect());
117+
}
118+
});
119+
jDialog.add(jButton);
120+
JButton jButton1 = new JButton("刷新");
121+
jDialog.add(jButton1);
122+
jButton1.addActionListener(new ActionListener() {
123+
@Override
124+
public void actionPerformed(ActionEvent e) {
125+
entry.generateHTML();
126+
try {
127+
entry.generateCurrentHash();
128+
} catch (UnsupportedEncodingException ex) {
129+
throw new RuntimeException(ex);
130+
}
131+
jLabel.setText(entry.generateHTML());
132+
jLabel.paintImmediately(jLabel.getVisibleRect());
133+
}
134+
});
135+
jDialog.setVisible(true);
136+
}
137+
138+
public void viewEntry(Entry entry, JFrame parentJFrame) throws UnsupportedEncodingException {
139+
JDialog jDialog = new JDialog(parentJFrame);
140+
jDialog.setSize(800, 600);
141+
jDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
142+
jDialog.setLayout(new FlowLayout());
92143
entry.generateHTML();
93144
entry.generateCurrentHash();
94-
frame.add(new JLabel(entry.generateHTML()));
95-
entry.editEntry(frame);
96-
frame.setVisible(true);
145+
JLabel jLabel = new JLabel(entry.generateHTML());
146+
jDialog.add(jLabel);
147+
JButton jButton = new JButton("编辑");
148+
jDialog.add(jButton);
149+
jButton.addActionListener(new ActionListener() {
150+
@Override
151+
public void actionPerformed(ActionEvent e) {
152+
editEntry(jDialog);
153+
entry.generateHTML();
154+
try {
155+
entry.generateCurrentHash();
156+
} catch (UnsupportedEncodingException ex) {
157+
throw new RuntimeException(ex);
158+
}
159+
jLabel.setText(entry.generateHTML());
160+
}
161+
});
162+
jDialog.add(jButton);
163+
JButton jButton1 = new JButton("刷新");
164+
jDialog.add(jButton1);
165+
jButton1.addActionListener(new ActionListener() {
166+
@Override
167+
public void actionPerformed(ActionEvent e) {
168+
entry.generateHTML();
169+
try {
170+
entry.generateCurrentHash();
171+
} catch (UnsupportedEncodingException ex) {
172+
throw new RuntimeException(ex);
173+
}
174+
jLabel.setText(entry.generateHTML());
175+
}
176+
});
177+
jDialog.setVisible(true);
97178
}
98179

99180
public void editEntry(JFrame parentJFrame) {
@@ -206,6 +287,17 @@ public void editEntry(JFrame parentJFrame) {
206287
gridBagConstraints.gridx = 0;
207288
gridBagConstraints.gridy = 12;
208289
gridBagConstraints.gridwidth = 1;
290+
JTable jTable = new JTable();
291+
TableColumn tableColumn = new TableColumn();
292+
tableColumn.setHeaderValue("贡献者");
293+
jTable.addColumn(tableColumn);
294+
jDialog.add(jTable, gridBagConstraints);
295+
gridBagConstraints.gridx = 1;
296+
gridBagConstraints.gridwidth = 3;
297+
jDialog.add(jTable, gridBagConstraints);
298+
gridBagConstraints.gridx = 0;
299+
gridBagConstraints.gridy = 13;
300+
gridBagConstraints.gridwidth = 1;
209301
JButton jButton = new JButton("保存");
210302
jDialog.add(jButton, gridBagConstraints);
211303
jButton.addActionListener(new ActionListener() {
@@ -339,6 +431,17 @@ public void editEntry(JDialog parentJDialog) {
339431
gridBagConstraints.gridx = 0;
340432
gridBagConstraints.gridy = 12;
341433
gridBagConstraints.gridwidth = 1;
434+
JTable jTable = new JTable();
435+
TableColumn tableColumn = new TableColumn();
436+
tableColumn.setHeaderValue("贡献者");
437+
jTable.addColumn(tableColumn);
438+
jDialog.add(jTable, gridBagConstraints);
439+
gridBagConstraints.gridx = 1;
440+
gridBagConstraints.gridwidth = 3;
441+
jDialog.add(jTable, gridBagConstraints);
442+
gridBagConstraints.gridx = 0;
443+
gridBagConstraints.gridy = 13;
444+
gridBagConstraints.gridwidth = 1;
342445
JButton jButton = new JButton("保存");
343446
jDialog.add(jButton, gridBagConstraints);
344447
jButton.addActionListener(new ActionListener() {

0 commit comments

Comments
 (0)