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

Commit eb3851b

Browse files
committed
feat: Update screen, fix console tab
1 parent 5c2f132 commit eb3851b

File tree

8 files changed

+101
-17
lines changed

8 files changed

+101
-17
lines changed

EncryptionAlgorithms/src/algorithms/CaesarCipher.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public void setKey(int key) {
4646

4747
public static void debug(String str) {
4848
if (console == null) {
49-
System.out.println("algorithms.CaesarCipher.debug()");
5049
return;
5150
}
5251
console.setText(console.getText() + "\n" + str);

EncryptionAlgorithms/src/algorithms/Playfair.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public void debug(String str) {
236236
if (console == null) {
237237
return;
238238
}
239-
console.setText(console.getText() + "\n\n" + str);
239+
console.setText(console.getText() + "\n" + str);
240240
console.setCaretPosition(console.getText().length());
241241
}
242242

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3+
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4+
*/
5+
package application;
6+
7+
/**
8+
*
9+
* @author duong
10+
*/
11+
public class InfoSoftware {
12+
public static final String VERSION = "1.0";
13+
}

EncryptionAlgorithms/src/gui/GUI_MainApplication.form

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,22 @@
1717
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="menuItem_ViewMyProfileActionPerformed"/>
1818
</Events>
1919
</MenuItem>
20+
<MenuItem class="javax.swing.JMenuItem" name="menuItem_Info">
21+
<Properties>
22+
<Property name="text" type="java.lang.String" value="Th&#xf4;ng tin ph&#x1ea7;n m&#x1ec1;m"/>
23+
</Properties>
24+
<Events>
25+
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="menuItem_InfoActionPerformed"/>
26+
</Events>
27+
</MenuItem>
28+
<MenuItem class="javax.swing.JMenuItem" name="menuItem_Download">
29+
<Properties>
30+
<Property name="text" type="java.lang.String" value="T&#x1ea3;i phi&#xea;n b&#x1ea3;n m&#x1edb;i"/>
31+
</Properties>
32+
<Events>
33+
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="menuItem_DownloadActionPerformed"/>
34+
</Events>
35+
</MenuItem>
2036
<MenuItem class="javax.swing.JMenuItem" name="menuItem_XemMaNguon">
2137
<Properties>
2238
<Property name="text" type="java.lang.String" value="Xem m&#xe3; ngu&#x1ed3;n m&#x1edf;"/>

EncryptionAlgorithms/src/gui/GUI_MainApplication.java

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
package gui;
66

7+
import application.InfoSoftware;
78
import java.awt.Desktop;
89
import java.net.URI;
910
import java.net.URL;
@@ -36,6 +37,8 @@ private void initComponents() {
3637
jMenuBar1 = new javax.swing.JMenuBar();
3738
jMenu1 = new javax.swing.JMenu();
3839
menuItem_ViewMyProfile = new javax.swing.JMenuItem();
40+
menuItem_Info = new javax.swing.JMenuItem();
41+
menuItem_Download = new javax.swing.JMenuItem();
3942
menuItem_XemMaNguon = new javax.swing.JMenuItem();
4043

4144
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
@@ -51,6 +54,22 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
5154
});
5255
jMenu1.add(menuItem_ViewMyProfile);
5356

57+
menuItem_Info.setText("Thông tin phần mềm");
58+
menuItem_Info.addActionListener(new java.awt.event.ActionListener() {
59+
public void actionPerformed(java.awt.event.ActionEvent evt) {
60+
menuItem_InfoActionPerformed(evt);
61+
}
62+
});
63+
jMenu1.add(menuItem_Info);
64+
65+
menuItem_Download.setText("Tải phiên bản mới");
66+
menuItem_Download.addActionListener(new java.awt.event.ActionListener() {
67+
public void actionPerformed(java.awt.event.ActionEvent evt) {
68+
menuItem_DownloadActionPerformed(evt);
69+
}
70+
});
71+
jMenu1.add(menuItem_Download);
72+
5473
menuItem_XemMaNguon.setText("Xem mã nguồn mở");
5574
menuItem_XemMaNguon.addActionListener(new java.awt.event.ActionListener() {
5675
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -88,6 +107,26 @@ private void menuItem_ViewMyProfileActionPerformed(java.awt.event.ActionEvent ev
88107
}
89108
}//GEN-LAST:event_menuItem_ViewMyProfileActionPerformed
90109

110+
private void menuItem_DownloadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItem_DownloadActionPerformed
111+
// TODO add your handling code here:
112+
113+
try {
114+
URL url = new URL("https://github.com/kennex666/EncryptionAlgorithm-Java/releases/");
115+
116+
openWebpage(url.toURI());
117+
} catch (Exception e) {
118+
JOptionPane.showMessageDialog(null, "Không thể mở web do thiếu API Desktop, truy cập tại: https://github.com/kennex666/EncryptionAlgorithm-Java/releases/");
119+
}
120+
}//GEN-LAST:event_menuItem_DownloadActionPerformed
121+
122+
private void menuItem_InfoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuItem_InfoActionPerformed
123+
// TODO add your handling code here:
124+
JOptionPane.showMessageDialog(null,
125+
"Các thuật toán mã hoá - Phiên bản " + InfoSoftware.VERSION
126+
+ "\nViết bởi: Dương Thái Bảo"
127+
);
128+
}//GEN-LAST:event_menuItem_InfoActionPerformed
129+
91130
public static boolean openWebpage(URI uri) {
92131
Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
93132
if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
@@ -140,6 +179,8 @@ public void run() {
140179
private javax.swing.JMenu jMenu1;
141180
private javax.swing.JMenuBar jMenuBar1;
142181
private javax.swing.JTabbedPane jTabbedPane1;
182+
private javax.swing.JMenuItem menuItem_Download;
183+
private javax.swing.JMenuItem menuItem_Info;
143184
private javax.swing.JMenuItem menuItem_ViewMyProfile;
144185
private javax.swing.JMenuItem menuItem_XemMaNguon;
145186
// End of variables declaration//GEN-END:variables
@@ -148,7 +189,7 @@ private void initApp() {
148189
Panel_MaHoaCoDien panelMaHoaCoDien = new Panel_MaHoaCoDien();
149190

150191
jTabbedPane1.add(panelMaHoaCoDien, "Mã hoá cổ điển");
151-
this.setTitle("Các thuật toán mã hoá | (c) Dương Thái Bảo - DHKTPM17B - FIT@IUH");
192+
this.setTitle("Các thuật toán mã hoá | " + InfoSoftware.VERSION + " | (c) Dương Thái Bảo - DHKTPM17B - FIT@IUH");
152193

153194
}
154195
}

EncryptionAlgorithms/src/gui/Panel_MaHoaCoDien.form

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@
268268
<Container class="javax.swing.JPanel" name="panelConsole">
269269
<Constraints>
270270
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
271-
<GridBagConstraints gridX="2" gridY="2" gridWidth="1" gridHeight="11" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
271+
<GridBagConstraints gridX="2" gridY="2" gridWidth="1" gridHeight="11" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.1" weightY="0.0"/>
272272
</Constraint>
273273
</Constraints>
274274
<SubComponents>
@@ -1833,6 +1833,19 @@
18331833
</CodeExpression>
18341834
</Parameters>
18351835
</CodeStatement>
1836+
<CodeStatement>
1837+
<CodeExpression id="104_gridBagConstraints"/>
1838+
<StatementProvider type="CodeField">
1839+
<CodeField name="weightx" class="java.awt.GridBagConstraints"/>
1840+
</StatementProvider>
1841+
<Parameters>
1842+
<CodeExpression id="109">
1843+
<ExpressionOrigin>
1844+
<Value type="double" value="0.1"/>
1845+
</ExpressionOrigin>
1846+
</CodeExpression>
1847+
</Parameters>
1848+
</CodeStatement>
18361849
<CodeStatement>
18371850
<CodeExpression id="25"/>
18381851
<StatementProvider type="CodeMethod">
@@ -1844,7 +1857,7 @@
18441857
</Parameters>
18451858
</CodeStatement>
18461859
<CodeStatement>
1847-
<CodeExpression id="109_gridBagConstraints">
1860+
<CodeExpression id="110_gridBagConstraints">
18481861
<CodeVariable name="gridBagConstraints"/>
18491862
<ExpressionOrigin>
18501863
<ExpressionProvider type="CodeConstructor">
@@ -1853,42 +1866,42 @@
18531866
</ExpressionOrigin>
18541867
</CodeExpression>
18551868
<StatementProvider type="CodeExpression">
1856-
<CodeExpression id="109_gridBagConstraints"/>
1869+
<CodeExpression id="110_gridBagConstraints"/>
18571870
</StatementProvider>
18581871
</CodeStatement>
18591872
<CodeStatement>
1860-
<CodeExpression id="109_gridBagConstraints"/>
1873+
<CodeExpression id="110_gridBagConstraints"/>
18611874
<StatementProvider type="CodeField">
18621875
<CodeField name="gridx" class="java.awt.GridBagConstraints"/>
18631876
</StatementProvider>
18641877
<Parameters>
1865-
<CodeExpression id="110">
1878+
<CodeExpression id="111">
18661879
<ExpressionOrigin>
18671880
<Value type="int" value="6"/>
18681881
</ExpressionOrigin>
18691882
</CodeExpression>
18701883
</Parameters>
18711884
</CodeStatement>
18721885
<CodeStatement>
1873-
<CodeExpression id="109_gridBagConstraints"/>
1886+
<CodeExpression id="110_gridBagConstraints"/>
18741887
<StatementProvider type="CodeField">
18751888
<CodeField name="gridy" class="java.awt.GridBagConstraints"/>
18761889
</StatementProvider>
18771890
<Parameters>
1878-
<CodeExpression id="111">
1891+
<CodeExpression id="112">
18791892
<ExpressionOrigin>
18801893
<Value type="int" value="10"/>
18811894
</ExpressionOrigin>
18821895
</CodeExpression>
18831896
</Parameters>
18841897
</CodeStatement>
18851898
<CodeStatement>
1886-
<CodeExpression id="109_gridBagConstraints"/>
1899+
<CodeExpression id="110_gridBagConstraints"/>
18871900
<StatementProvider type="CodeField">
18881901
<CodeField name="fill" class="java.awt.GridBagConstraints"/>
18891902
</StatementProvider>
18901903
<Parameters>
1891-
<CodeExpression id="112">
1904+
<CodeExpression id="113">
18921905
<ExpressionOrigin>
18931906
<Value type="int" value="1"/>
18941907
</ExpressionOrigin>
@@ -1901,15 +1914,15 @@
19011914
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
19021915
</StatementProvider>
19031916
<Parameters>
1904-
<CodeExpression id="113_btnRandom">
1917+
<CodeExpression id="114_btnRandom">
19051918
<CodeVariable name="btnRandom" type="8194" declaredType="javax.swing.JButton"/>
19061919
<ExpressionOrigin>
19071920
<ExpressionProvider type="ComponentRef">
19081921
<ComponentRef name="btnRandom"/>
19091922
</ExpressionProvider>
19101923
</ExpressionOrigin>
19111924
</CodeExpression>
1912-
<CodeExpression id="109_gridBagConstraints"/>
1925+
<CodeExpression id="110_gridBagConstraints"/>
19131926
</Parameters>
19141927
</CodeStatement>
19151928
</LayoutCode>

EncryptionAlgorithms/src/gui/Panel_MaHoaCoDien.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
314314
gridBagConstraints.gridy = 2;
315315
gridBagConstraints.gridheight = 11;
316316
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
317+
gridBagConstraints.weightx = 0.1;
317318
add(panelConsole, gridBagConstraints);
318319

319320
btnRandom.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
@@ -429,8 +430,8 @@ private void btnRandomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR
429430
int lengthContent = random.nextInt(10) + 7;
430431

431432
txtLoadConsole.setText( txtLoadConsole.getText() + "\n----\n Khởi tạo ngẫu nhiên dữ liệu cho " + thuatToanDangChon);
432-
txtLoadConsole.setText( txtLoadConsole.getText() + "\n Độ dài KHOÁ " + lengthKey );
433-
txtLoadConsole.setText( txtLoadConsole.getText() + "\n Độ dài DỮ LIỆU" + lengthContent );
433+
txtLoadConsole.setText( txtLoadConsole.getText() + "\n Độ dài KHOÁ: " + lengthKey );
434+
txtLoadConsole.setText( txtLoadConsole.getText() + "\n Độ dài DỮ LIỆU: " + lengthContent );
434435

435436
switch (thuatToanDangChon) {
436437
case PLAYFAIR ->{

EncryptionAlgorithms/src/gui/SplashLoading.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
package gui;
66

7+
import application.InfoSoftware;
78
import java.time.LocalDate;
89

910

@@ -62,7 +63,7 @@ private void initComponents() {
6263
jLabel1.setText("Các thuật toán mã hoá");
6364

6465
jLabel2.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
65-
jLabel2.setText("Version: 1.0.0");
66+
jLabel2.setText("Version: " + InfoSoftware.VERSION);
6667

6768
jLabel3.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N
6869
jLabel3.setText("(C) " + LocalDate.now().getYear() +" Dương Thái Bảo (21037621) - DHKTPM17B - FIT@IUH");

0 commit comments

Comments
 (0)