Set version in about page from pom.xml variable.
This commit is contained in:
@@ -3,9 +3,9 @@ package net.themusicinnoise.vaccalc;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.io.BufferedReader;
|
import java.io.*;
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.time.YearMonth;
|
import java.time.YearMonth;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class VacCalc extends JFrame {
|
public class VacCalc extends JFrame {
|
||||||
@@ -72,10 +72,17 @@ public class VacCalc extends JFrame {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent ev) {
|
public void actionPerformed(ActionEvent ev) {
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("about.html")));
|
BufferedReader br = new BufferedReader(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("about.html")));
|
||||||
|
Properties properties = new Properties();
|
||||||
|
try {
|
||||||
|
properties.load(getClass().getClassLoader().getResourceAsStream("project.properties"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println("Failed to load project properties.");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
String aboutText = br.lines().collect(Collectors.joining());
|
String aboutText = br.lines().collect(Collectors.joining());
|
||||||
JOptionPane.showMessageDialog(VacCalc.this,
|
aboutText = aboutText.replace("VERSION", properties.getProperty("version"));
|
||||||
aboutText,
|
JOptionPane.showMessageDialog(VacCalc.this, aboutText, "About",
|
||||||
"About", JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.INFORMATION_MESSAGE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
helpMenu.add(aboutItem);
|
helpMenu.add(aboutItem);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<html>
|
<html>
|
||||||
<p><b>VacCalc v1.0.0</b></p>
|
<p><b>VacCalc VERSION</b></p>
|
||||||
<hr />
|
<hr />
|
||||||
<p>Copyright © 2026 Nicolás A. Ortega Froysa <nicolas@ortegas.org></p>
|
<p>Copyright © 2026 Nicolás A. Ortega Froysa <nicolas@ortegas.org></p>
|
||||||
<p>License: Zlib</p>
|
<p>License: Zlib</p>
|
||||||
|
|||||||
1
src/main/resources/project.properties
Normal file
1
src/main/resources/project.properties
Normal file
@@ -0,0 +1 @@
|
|||||||
|
version=${project.version}
|
||||||
Reference in New Issue
Block a user