1 | //static double showYesToAcceptPopup_hideAfter = 10.0; |
2 | sS showYesToAcceptPopup_imageID = #1101458; // #1101459 for "ok" instead of "yes" (wit.ai is bad at recognizing "yes") |
3 | |
4 | static YesPopup showYesToAcceptPopup(final Component c, fO... _) {
|
5 | ret c == null ? null : swing(func -> YesPopup {
|
6 | final JDesktopPane desktop = parentOfType(c, JDesktopPane.class); |
7 | if (desktop == null) null; |
8 | S imageID = optPar(_, imageID := showYesToAcceptPopup_imageID); |
9 | int height = optPar(_, height := 114); |
10 | final YesPopup popup = setSizeToPreferredSize(YesPopup(c, imageID, height)); |
11 | fO mover = optPar(_, 'mover); // voidfunc(Component c, Component popup) |
12 | Runnable moveIt = r {
|
13 | if (!isComponentShowing(c)) ret with removeFromParent(popup); |
14 | if (mover != null) |
15 | callF(mover, c, popup); |
16 | else {
|
17 | Rect r = boundsInParent(c, desktop); |
18 | setLocation(popup, r.x+r.w/2, r.y-popup.getHeight()-5); |
19 | } |
20 | }; |
21 | desktop.add(popup, JLayeredPane.POPUP_LAYER); |
22 | onClick(popup, r { removeFromParent(popup) });
|
23 | callF(moveIt); |
24 | awtEvery(popup, 100, moveIt); |
25 | //removeFromParentAfter(showYesToAcceptPopup_hideAfter, popup); |
26 | ret popup; |
27 | }); |
28 | } |
download show line numbers debug dex old transpilations
Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1020262 |
| Snippet name: | showYesToAcceptPopup |
| Eternal ID of this version: | #1020262/27 |
| Text MD5: | 5ba432212f7757876968c21bb15c7b39 |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-01-22 17:03:47 |
| Source code size: | 1219 bytes / 28 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 531 / 630 |
| Version history: | 26 change(s) |
| Referenced in: | [show references] |