Do launchFXAppleCommander the FX way

In JavaFX applications, main is apparently not used unless the caller is
completely ignorant of JavaFX and how it works, but it's still
convention to provide it.  We could dynamically find our GUI and the
JavaFX Application class and use the latter to call the former.

Or y'know we can take advantage of the fact that main() can know what a
JavaFX Application is and just call it.

NOW we just need to write the JavaFX GUI!
This commit is contained in:
T. Joseph Carter 2017-11-16 00:57:18 -08:00
parent 830b4966d2
commit 6916d8136f
1 changed files with 4 additions and 4 deletions

View File

@ -108,12 +108,12 @@ public class AppleCommander {
protected static void launchFXAppleCommander(String[] args) {
Class<?> fxAppleCommander;
try {
fxAppleCommander = Class.forName(
fxAppleCommander = Class.forName(
"com.webcodepro.applecommander.ui.fx.FXAppleCommander"); //$NON-NLS-1$
Object object = fxAppleCommander.newInstance();
Method launchMethod = fxAppleCommander.
getMethod("launch", (Class[]) null); //$NON-NLS-1$
launchMethod.invoke(object, (Object[]) null);
Method launchMethod = fxAppleCommander.getMethod(
"main", new Class[] { String[].class }); //$NON-NLS-1$
launchMethod.invoke(object, new Object[] { args });
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SecurityException e) {