sclass JG22Label > SingleComponentPanel { G22Label label; JLabel jLabel; JTextField tf; event doneEditing(S text); *() { init(); } *(G22Label *label) { init(); } A print(A a) { ret main print(a); } void init { onDoneEditing(text -> print("Done editing label")); if (label == null) { tf = jTextField(); onEnter(tf, rThread { doneEditing(getTextTrim(tf)) }); setComponent(tf); } else { jLabel = jLabel(label.name); setComponent(jLabel); } } JComponent focusablePart() { ret tf; } }