
com.fathzer.launcher.Swing Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-check-launcher Show documentation
Show all versions of java-check-launcher Show documentation
A java application launcher that checks if used JRE is
compatible with launched application
The newest version!
package com.fathzer.launcher;
import java.text.MessageFormat;
import java.util.ResourceBundle;
import javax.swing.JOptionPane;
/** A {@link Logger} that outputs its messages to a Swing dialog.
*/
public class Swing implements Logger {
private static final String DIALOG_TITLE;
private static final String WRONG_JAVA_VERSION_PATTERN;
private static final String FATAL_ERROR_PATTERN;
static {
final ResourceBundle bundle = Localization.MESSAGES;
DIALOG_TITLE = bundle.getString("swing.dialog.title");
WRONG_JAVA_VERSION_PATTERN = bundle.getString("swing.unsupported.java.version.pattern");
FATAL_ERROR_PATTERN = bundle.getString("swing.fatal.error.pattern");
}
public void fatalError(Exception exception) {
final Object[] args = new Object[]{exception.toString()};
error(MessageFormat.format(FATAL_ERROR_PATTERN, args));
}
public void wrongJavaVersion(Version min, String current) {
final Object[] args = new Object[] {current, min};
error(MessageFormat.format(WRONG_JAVA_VERSION_PATTERN, args));
}
private void error(String message) {
JOptionPane.showMessageDialog(null, message, DIALOG_TITLE, JOptionPane.ERROR_MESSAGE);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy