Libraryless. Click here for Pure Java version (16440L/96K).
// Note: Putting a JForm in a scroll pane is still under development // jscroll_vertical seems to work, at least if there are no tall components // (text areas). sclass JForm is Swingable { new L parts; new FormLayout1 layout; JPanel panel; settable bool scrollable; // called after form is submitted. // can set or change at any point after form is generated/shown settable IVF1<Component> frameCloser; *(O... parts) { this.parts = asList(parts); } selfType addRow(S label, Component etc component) { addAll(parts, label, component); this; } cachedVisualize { panel = jpanel(layout, showForm_arrange1(showForm_makeComponents( c -> { frameCloser?.get(c); }, flattenToArray(parts)))); ret scrollable ? jscroll_vertical(panel) : panel; } selfType closeInternalFrameOnSubmit() { frameCloser(l1 disposeInternalFrame); this; } selfType closeFrameOnSubmit aka disposeFrameOnSubmit() { frameCloser(l1 disposeFrame); this; } selfType closeNothingOnSubmit() { frameCloser(null); this; } }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035073 |
Snippet name: | JForm - create a Swing form |
Eternal ID of this version: | #1035073/13 |
Text MD5: | 199032cba7df8d99de2191d8340f7f57 |
Transpilation MD5: | 37b1f3c92b9b97abf7d21c2ca5fb3c47 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-11-13 21:27:10 |
Source code size: | 1101 bytes / 33 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 218 / 348 |
Version history: | 12 change(s) |
Referenced in: | #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167) |