static abstract class DynSingleFunction extends DynModule { transient S buttonText; *() {} *(S *buttonText) {} // call before visualize void setFunctionName(S name) { buttonText = name; } visualize { ret jfullcenter(withMargin(makeButtons())); } JComponent makeButtons() { ret jbutton(or2(buttonText, dm_moduleName()), rThread doItWithEnter); } abstract void doIt(); void doItWithEnter() { temp enter(); try { doIt(); } catch e { print(getStackTrace(e)); } } }