Libraryless. Click here for Pure Java version (7122L/40K).
// x = names and components interleaving. // or just components. // or just names. // also, you can pass a Collection containing the elements svoid addTabs(JTabbedPane tabs, O... x) { if (tabs == null) ret; x = flattenToArray(x); for i over x: { // is it a component? O o = x[i]; if (isComponentOrSwingable(o)) addTab(tabs, "Tab " + (tabCount(tabs)+1), wrap(o)); else { // assume it's a tab name, optionally followed by a component S toolTip = ""; // WithToolTip<S> is ok (WithToolTip<Component> not yet supported) if (o cast WithToolTip) { toolTip = o.toolTip(); o = o!; } S name = str(or(o, "Tab " + tabCount(tabs)+1)); Component c; if (isComponentOrSwingable(get(x, i+1))) c = wrap(get(x, ++i)); else c = new JPanel; addTabWithToolTip(tabs, name, toolTip, wrap(c)); } } }
Began life as a copy of #1020846
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034285 |
Snippet name: | addTabs - fill JTabbedPane |
Eternal ID of this version: | #1034285/8 |
Text MD5: | 34e1e843b57d2477ecad0490c8940f22 |
Transpilation MD5: | 1295d520876eb70269bf40a826a8691c |
Author: | stefan |
Category: | |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-31 22:54:30 |
Source code size: | 937 bytes / 31 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 135 / 205 |
Version history: | 7 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |