Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

43
LINES

< > BotCompany Repo | #1030790 // +Enabled include (inner)

JavaX fragment (include)

1  
volatile bool enabled = true;
2  
transient JPanel buttons;
3  
transient SingleComponentPanel scpStretcherControl;
4  
5  
JComponent visualizeWithoutEnabled() { ret super.visualize(); }
6  
  
7  
JComponent dm_visualizeWithEnabled(JComponent main) {
8  
  ret centerAndSouthWithMargins(main, wrapControlArea());
9  
}
10  
11  
JComponent wrapControlArea() {
12  
  ret makeControlArea();
13  
}
14  
15  
JPanel makeControlArea() {
16  
  if (scpStretcherControl == null)
17  
    scpStretcherControl = singleComponentPanel();
18  
  var cb = makeEnabledCheckBox();
19  
  buttons = jrightalignedline(cb);
20  
  ret centerAndEastWithMargin(scpStretcherControl, buttons);
21  
}
22  
23  
static JCheckBox makeEnabledCheckBox() {
24  
  ret dm_fieldCheckBox('enabled);
25  
}
26  
  
27  
void setEnabled(bool b) { setField(enabled := b); }
28  
29  
void addToControlArea aka addControls(Component... components) {
30  
  addComponentsFirst(buttons, components);
31  
}
32  
33  
void addButton aka addControl(Component component) {
34  
  addComponentsFirst(buttons, component);
35  
}
36  
37  
void addControl(Swingable component) {
38  
  addComponentsFirst(buttons, wrap(component));
39  
}
40  
41  
void setMainControl(JComponent control) {
42  
  scpSet(scpStretcherControl, control);
43  
}

Author comment

Began life as a copy of #1023104

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, vouqrxazstgt, wnsclhtenguj

No comments. add comment

Snippet ID: #1030790
Snippet name: +Enabled include (inner)
Eternal ID of this version: #1030790/12
Text MD5: 474c925544ae84200c02458acdf1b130
Author: stefan
Category: javax / stefan's os
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-12-28 01:08:42
Source code size: 1152 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 150 / 2552
Version history: 11 change(s)
Referenced in: [show references]