Skip to content

Commit f6408e5

Browse files
committed
V1.0
1 parent 8b90ad4 commit f6408e5

File tree

14 files changed

+1688
-2
lines changed

14 files changed

+1688
-2
lines changed

FirmwareUpdateUI.png

77.8 KB
Loading

FirmwareUpdateUI/.classpath

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4+
<classpathentry kind="src" path="src"/>
5+
<classpathentry kind="output" path="bin"/>
6+
</classpath>

FirmwareUpdateUI/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/

FirmwareUpdateUI/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>FirmwareUpdateUI</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.jdt.core.javanature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5+
org.eclipse.jdt.core.compiler.compliance=1.8
6+
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7+
org.eclipse.jdt.core.compiler.debug.localVariable=generate
8+
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11+
org.eclipse.jdt.core.compiler.release=enabled
12+
org.eclipse.jdt.core.compiler.source=1.8

FirmwareUpdateUI/build.num

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#Build Number for ANT. Do not edit!
2+
#Wed Feb 23 16:54:04 CET 2022
3+
build.number=2
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
/**
2+
* @file About.java
3+
*
4+
*/
5+
/* Copyright (C) 2022 by Arjan van Vught mailto:[email protected]
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*/
25+
26+
package org.gd32.dmx;
27+
28+
import java.awt.Color;
29+
import java.awt.Desktop;
30+
import java.io.IOException;
31+
import java.net.URI;
32+
33+
import javax.swing.GroupLayout;
34+
import javax.swing.GroupLayout.Alignment;
35+
import javax.swing.JDialog;
36+
import javax.swing.JLabel;
37+
import javax.swing.JTextField;
38+
import javax.swing.JTextPane;
39+
import javax.swing.LayoutStyle.ComponentPlacement;
40+
import javax.swing.SwingConstants;
41+
import javax.swing.event.HyperlinkEvent;
42+
import javax.swing.event.HyperlinkListener;
43+
44+
public class About extends JDialog {
45+
private static final long serialVersionUID = 989628609152233931L;
46+
private JTextField txtArjan;
47+
private JLabel lblBuildNumber;
48+
49+
public static void main(String[] args) {
50+
try {
51+
About dialog = new About();
52+
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
53+
dialog.setVisible(true);
54+
} catch (Exception e) {
55+
e.printStackTrace();
56+
}
57+
}
58+
59+
public About() {
60+
getContentPane().setBackground(Color.WHITE);
61+
setModal(true);
62+
setResizable(false);
63+
setTitle("About");
64+
setBounds(100, 100, 439, 170);
65+
66+
JTextPane htmlURL = new JTextPane();
67+
htmlURL.setEditable(false);
68+
htmlURL.setContentType("text/html");
69+
htmlURL.setText("<html>Website <a href=\"http://www.gd32-dmx.org\">http://www.gd32-dmx.org</a></html>");
70+
htmlURL.addHyperlinkListener(new HyperlinkListener() {
71+
@Override
72+
public void hyperlinkUpdate(HyperlinkEvent e) {
73+
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
74+
String url = e.getURL().toString();
75+
try {
76+
Desktop.getDesktop().browse(URI.create(url));
77+
} catch (IOException e1) {
78+
e1.printStackTrace();
79+
}
80+
}
81+
}
82+
});
83+
84+
JTextPane htmlGitHub = new JTextPane();
85+
htmlGitHub.setEditable(false);
86+
htmlGitHub.setContentType("text/html");
87+
htmlGitHub.setText(
88+
"<html>Source <a href=\"https://github.com/vanvught/GD32F-Firmware-Update-UI\">https://github.com/vanvught/GD32F-Firmware-Update-UI</a></html>\"");
89+
htmlGitHub.addHyperlinkListener(new HyperlinkListener() {
90+
@Override
91+
public void hyperlinkUpdate(HyperlinkEvent e) {
92+
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
93+
String url = e.getURL().toString();
94+
try {
95+
Desktop.getDesktop().browse(URI.create(url));
96+
} catch (IOException e1) {
97+
e1.printStackTrace();
98+
}
99+
}
100+
}
101+
});
102+
103+
JTextPane htmlDonate = new JTextPane();
104+
htmlDonate.setEditable(false);
105+
htmlDonate.setContentType("text/html");
106+
htmlDonate.setText(
107+
"<html>PayPal.Me <b>Donate</b> <a href=\"https://paypal.me/AvanVught\">https://paypal.me/AvanVught</a></html>\"");
108+
htmlDonate.addHyperlinkListener(new HyperlinkListener() {
109+
@Override
110+
public void hyperlinkUpdate(HyperlinkEvent e) {
111+
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
112+
String url = e.getURL().toString();
113+
try {
114+
Desktop.getDesktop().browse(URI.create(url));
115+
} catch (IOException e1) {
116+
e1.printStackTrace();
117+
}
118+
}
119+
}
120+
});
121+
122+
txtArjan = new JTextField();
123+
txtArjan.setBorder(null);
124+
txtArjan.setHorizontalAlignment(SwingConstants.CENTER);
125+
txtArjan.setText("(C) 2022 Arjan van Vught");
126+
txtArjan.setEditable(false);
127+
txtArjan.setColumns(10);
128+
129+
lblBuildNumber = new JLabel("Build.Number");
130+
131+
JLabel lblBuild = new JLabel("Version:");
132+
GroupLayout groupLayout = new GroupLayout(getContentPane());
133+
groupLayout.setHorizontalGroup(
134+
groupLayout.createParallelGroup(Alignment.LEADING)
135+
.addGroup(groupLayout.createSequentialGroup()
136+
.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
137+
.addGroup(groupLayout.createSequentialGroup()
138+
.addGap(6)
139+
.addComponent(htmlURL, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
140+
.addComponent(txtArjan, GroupLayout.PREFERRED_SIZE, 430, GroupLayout.PREFERRED_SIZE)
141+
.addGroup(groupLayout.createSequentialGroup()
142+
.addGap(6)
143+
.addComponent(htmlGitHub, GroupLayout.PREFERRED_SIZE, 365, GroupLayout.PREFERRED_SIZE))
144+
.addGroup(groupLayout.createSequentialGroup()
145+
.addContainerGap()
146+
.addComponent(htmlDonate, GroupLayout.PREFERRED_SIZE, 295, GroupLayout.PREFERRED_SIZE)))
147+
.addGap(9))
148+
.addGroup(groupLayout.createSequentialGroup()
149+
.addContainerGap()
150+
.addComponent(lblBuild)
151+
.addPreferredGap(ComponentPlacement.RELATED)
152+
.addComponent(lblBuildNumber, GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE)
153+
.addGap(281))
154+
);
155+
groupLayout.setVerticalGroup(
156+
groupLayout.createParallelGroup(Alignment.LEADING)
157+
.addGroup(groupLayout.createSequentialGroup()
158+
.addGap(7)
159+
.addComponent(htmlURL, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
160+
.addGap(6)
161+
.addComponent(htmlGitHub, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
162+
.addGap(9)
163+
.addComponent(htmlDonate, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
164+
.addPreferredGap(ComponentPlacement.RELATED)
165+
.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
166+
.addComponent(lblBuild)
167+
.addComponent(lblBuildNumber))
168+
.addPreferredGap(ComponentPlacement.RELATED)
169+
.addComponent(txtArjan, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
170+
.addGap(25))
171+
);
172+
getContentPane().setLayout(groupLayout);
173+
174+
}
175+
176+
public void setBuildNumber(String buildNumber) {
177+
lblBuildNumber.setText(buildNumber);
178+
}
179+
}

0 commit comments

Comments
 (0)