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)

volatile bool enabled = true;
transient JPanel buttons;
transient SingleComponentPanel scpStretcherControl;

JComponent visualizeWithoutEnabled() { ret super.visualize(); }
  
JComponent dm_visualizeWithEnabled(JComponent main) {
  ret centerAndSouthWithMargins(main, wrapControlArea());
}

JComponent wrapControlArea() {
  ret makeControlArea();
}

JPanel makeControlArea() {
  if (scpStretcherControl == null)
    scpStretcherControl = singleComponentPanel();
  var cb = makeEnabledCheckBox();
  buttons = jrightalignedline(cb);
  ret centerAndEastWithMargin(scpStretcherControl, buttons);
}

static JCheckBox makeEnabledCheckBox() {
  ret dm_fieldCheckBox('enabled);
}
  
void setEnabled(bool b) { setField(enabled := b); }

void addToControlArea aka addControls(Component... components) {
  addComponentsFirst(buttons, components);
}

void addButton aka addControl(Component component) {
  addComponentsFirst(buttons, component);
}

void addControl(Swingable component) {
  addComponentsFirst(buttons, wrap(component));
}

void setMainControl(JComponent control) {
  scpSet(scpStretcherControl, control);
}

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: 210 / 2623
Version history: 11 change(s)
Referenced in: [show references]