!7 module CurrentAction { transient JPanel stack; 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)); stack.add(c); ret new AnAction { public void close { removeComponent(stack, c); } public void setText(S text) { main.setText(lbl, text); } }; } }