Warning: session_start(): open(/var/lib/php/sessions/sess_6vo0j7cpu76ksbt0h9l23e7cm9, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
//please include function withMargin.
static int showForm_defaultGap = 4;
static JPanel showFormTitled(fS title, fO... _parts) {
ret swing(func -> JPanel {
final new Var frame;
JPanel panel = showForm_makePanel(frame, _parts);
frame.set(handleEscapeKey(minFrameWidth(showPackedFrame(title, withMargin(panel)), 400)));
ret panel;
});
}
static JPanel showForm_makePanel(final Var frame, O... _parts) {
new L l;
L parts = asList(_parts);
Runnable submit = null;
for (int i = 0; i < l(parts); i++) {
final O o = parts.get(i), next = get(parts, i+1);
if (o instanceof Component || o instanceof S || next instanceof Component) { // smartAdd accepts strings
l.add(ll(o == null ? new JPanel : o, next));
if (next instanceof JButton && submit == null)
submit = r { ((JButton) next).doClick() };
i++;
} else if (isRunnable(o))
l.add(ll(null, jbutton(showFormSubmitButtonName(), submit = r {
O result = call(o);
if (neq(Boolean.FALSE, result))
disposeFrame(frame.get());
})));
else print("showForm: Unknown element type: " + getClassName(o));
}
JPanel panel = hvgrid((L) l, showForm_defaultGap);
if (submit != null)
for (JTextField textField : childrenOfType(panel, JTextField.class))
onEnter(textField, submit);
ret panel;
}