Startup window based on Java Applet parameter

Put simply, I want to open a particular window if a particular parameter is supplied when my project is run as an applet.

I know if projects are launched normally then parameters can be passed in via the URL and they get translated into Client Tags (if such tags already exist).

IIRC this isn’t possible with an Applet, hence I’ve used the following code:

from javax.swing import JApplet from javax.swing import SwingUtilities applet = SwingUtilities.getAncestorOfClass(JApplet, event.source) value=applet.getParameter("paramName")

I don’t believe this can be run as a client startup script because it needs a window source (via the event object), so I’ve placed this in the internalFrameOpened event of a window that is opening.

The problem is that I can’t then seem to use system.nav.swapTo to open an alternative window. I’m guessing this is related to the fact that the current window is in the process of being opened.

One way I’ve found is to store the value in a client tag (or could be a custom property) and put a 1 second timer on the window that checks for a valid value and then does system.nav.swapTo.

While this works to an extent it seems messy and also means there is a brief period of time where the “intermediate” window is displayed.

Is there a better way? I’m using version 7.6.3.

I have the same problem.

You could try removing the ‘Open on startup’ setting from your initial windows and use a Client Startup script to open them. The Startup Script happens before the ‘Open on startup’ windows are opened, that may fix your timing issue.

You can grab system properties from java.lang.System.getProperty() without having an event object, but you’d need your own applet HTML to have those properties present.