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

27
LINES

< > BotCompany Repo | #1015640 // showSuggestion_master - shows only one suggestion at a time

JavaX fragment (include)

static JLabel showSuggestion_current;
sbool showSuggestion_keyListenerInstalled;

// action is called in new thread
static JLabel showSuggestion_master(fS suggestionText, fO action) {
  hideSuggestion();
  ret showSuggestion_makeMaster(showSuggestion_individual(suggestionText, action));
}

static JLabel showSuggestion_makeMaster(JLabel label) {
  JButton btnOK = firstButton(getWindow(label));
  setText(btnOK, getText(btnOK) + appendBracketed(hotKey_teach());
  showSuggestion_current = label;
  showSuggestion_installHotkey();
  ret label;
}

svoid showSuggestion_installHotkey {
  if (showSuggestion_keyListenerInstalled) ret;
  showSuggestion_keyListenerInstalled = true;
  onGlobalHotKey(hotKey_teach(), r-awt {
    bool b = isComponentShowing(showSuggestion_current);
    print("hotkey: " + b);
    if (b)
      clickFirstButton(getWindow(showSuggestion_current));
  });
}

Author comment

Began life as a copy of #1015586

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1015640
Snippet name: showSuggestion_master - shows only one suggestion at a time
Eternal ID of this version: #1015640/5
Text MD5: d7ca5365b43c9b6ae91d4abf53315ebb
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-21 00:55:11
Source code size: 906 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 305 / 335
Version history: 4 change(s)
Referenced in: [show references]