!7 module CurrentAction { transient JPanel stack; start { if (dm_getBounds() == null) { int w = getWidth(dm_desktopPane()), h = getHeight(dm_desktopPane()); dm_setBounds(this, w-300, 300, h-200, h); } } visualize { ret stack = dynamicVStack2(); } // API interface AnAction extends AutoCloseable { void setText(S text); } // Note: cancelMe will be called in GUI thread AutoCloseable showAction(S action, Runnable cancelMe) { final JLabel lbl = jlabel(action); final JComponent c = centerAndEast(lbl, jbutton("Cancel", cancelMe)); addAndValidate(stack, c); ret new AnAction { public void close { removeAndValidate(c); } public void setText(S text) { main.setText(lbl, text); } }; } }