params[i] = args[i + 1];
paramTypes[0] = params.getClass();
paramValues[0] = params;
// Create the icon window if this is a waitForChild task
Frame frame = null;
boolean displayMinimizedWindow = false;
if (System.getProperty(ChildMain.DISPLAY_MINIMIZED_WINDOW_PROP_NAME) != null)
displayMinimizedWindow = true;
String osname = System.getProperty("os.name").toLowerCase();
if (displayMinimizedWindow && osname.indexOf("windows") >= 0) {
try {
frame = new Frame();
String title = System.getProperty(ChildMain.MINIMIZED_WINDOW_TITLE_PROP_NAME);
if (title != null)
frame.setTitle(title);
frame.setState(Frame.ICONIFIED);
String icon = System.getProperty(ChildMain.MINIMIZED_WINDOW_TITLE_PROP_NAME);
if (icon != null) {
Image iconImage = Toolkit.getDefaultToolkit().createImage(icon);
if (iconImage != null)
frame.setIconImage(iconImage);
}
// Ensure that window always remains minimized
frame.addWindowListener(new ChildWindowAdapter());
Rectangle bounds = frame.getGraphicsConfiguration().getBounds();
int width = (int)frame.getBounds().getWidth();
int height = frame.getInsets().top + frame.getInsets().bottom;
int x = (int)bounds.getWidth() - width;
int y = (int)bounds.getHeight() - height;
frame.setBounds(x, y, width, height);
frame.setResizable(false);
frame.setVisible(true);
} catch(Exception fe) {}
}
// Invoke the main() method
Method mainMethod = mainClass.getDeclaredMethod("main", paramTypes);