[refactor] Remove duplications
This commit is contained in:
parent
6ec413ee30
commit
f25eced9fe
1 changed files with 8 additions and 8 deletions
|
@ -65,26 +65,26 @@ public class App {
|
||||||
|
|
||||||
/** @param out */
|
/** @param out */
|
||||||
public static void printAppInfos(PrintStream out) {
|
public static void printAppInfos(PrintStream out) {
|
||||||
Properties props = new Properties();
|
Properties props = readApplicationProperties();
|
||||||
try (InputStream is = App.class.getResourceAsStream("application.properties")) { //$NON-NLS-1$
|
|
||||||
props.load(is);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException("Unable to read application informations", e); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
out.println("Application: " + props.getProperty("app.name", UNSPECIFIED)); //$NON-NLS-1$ //$NON-NLS-2$
|
out.println("Application: " + props.getProperty("app.name", UNSPECIFIED)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
out.println("Version: " + props.getProperty("app.version", UNSPECIFIED)); //$NON-NLS-1$ //$NON-NLS-2$
|
out.println("Version: " + props.getProperty("app.version", UNSPECIFIED)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
out.println("By: " + props.getProperty("app.team", UNSPECIFIED)); //$NON-NLS-1$ //$NON-NLS-2$
|
out.println("By: " + props.getProperty("app.team", UNSPECIFIED)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Shows the logo in an image. */
|
private static Properties readApplicationProperties() {
|
||||||
public static void showLogo() {
|
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
try (InputStream is = App.class.getResourceAsStream("application.properties")) { //$NON-NLS-1$
|
try (InputStream is = App.class.getResourceAsStream("application.properties")) { //$NON-NLS-1$
|
||||||
props.load(is);
|
props.load(is);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new RuntimeException("Unable to read application informations", e); //$NON-NLS-1$
|
throw new RuntimeException("Unable to read application informations", e); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
return props;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Shows the logo in an image. */
|
||||||
|
public static void showLogo() {
|
||||||
|
Properties props = readApplicationProperties();
|
||||||
|
|
||||||
JFrame frame = new JFrame(props.getProperty("app.name")); //$NON-NLS-1$
|
JFrame frame = new JFrame(props.getProperty("app.name")); //$NON-NLS-1$
|
||||||
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||||
|
|
Reference in a new issue