Richard Pajerski  Software development and consulting

LS2J as an applet replacement

by Richard Pajerski


Posted on Thursday May 30, 2024 at 10:50PM in Technology


I'm currently reviewing LS2J as an alternative for replacing a number of custom Notes applets I've deployed over the years.  The applets have been very reliable and effective in areas where Notes is typically not that strong such as displaying and editing tabular data.  But with applets' deprecation in Java and their "broken" status in Notes 64-bit versions, I need a viable transition to something that can preserve the existing functionality/investment as much as possible.

Although I don't see any obvious way to embed top-level Java windows (JFrame, JDialog) in the same manner as applets (which can be placed on a form like most other widgets), with LS2J I've found I can call them from behind a simple button and in the case of JDialog, even block the Notes client without breaking things too badly.  I can also call a JFrame from LS2J but the window can quickly lose focus -- in the same way it does when called from a Java agent.  I believe this is due to it being launched on a separate thread.

Below is a contrived example with JDialog but so far so good;  I'm able to replace a form-based applet with a simple button that calls a JDialog, blocks for user input and then transfers the text back to Notes:


This is actually simpler than applets which require Javascript when transferring to/from Notes UI documents (not pleasant).

Our button code (Options):

Click function:

And our associated Script Library:

The JDialog class is a bit more involved but not important in the context of this post.  The important part consists of returning the contents of a JTextArea when "OK" is clicked:

public String getFieldData() {
    return jTextArea1.getText();

 }

And that's it!