Libraryless. Click here for Pure Java version (128L/2K/5K).
1 | !747 |
2 | !awt { |
3 | |
4 | m { |
5 | p { |
6 | awt { |
7 | L<JFrame> frames = listAllFrames(); |
8 | print(frames.size() + " frame(s) found."); |
9 | |
10 | L<JList> l = allSwingComponentsOfType(JList.class); |
11 | print(l.size() + " list(s) found."); |
12 | |
13 | for (JList list : l) { |
14 | if (!list.isShowing()) { |
15 | print("Skipping list, not showing."); |
16 | continue; |
17 | } |
18 | |
19 | ListModel model = list.getModel(); |
20 | print("List entries: " + model.getSize()); |
21 | |
22 | S myTag = "Kilroy was here! :)"; |
23 | |
24 | if (!(model instanceof DefaultListModel)) { |
25 | //print("Cannot modify, not a DefaultListModel (" + model.getClass().getName() + ")"); |
26 | convertToDefaultListModel(list); |
27 | model = list.getModel(); |
28 | } |
29 | |
30 | if (model.getSize() != 0 && eq(myTag, model.getElementAt(model.getSize()-1))) |
31 | print("Kilroy was here already :)"); |
32 | else { |
33 | print("Trying to add a string (yes it may fail if it's not a string list) :)"); |
34 | |
35 | DefaultListModel m = cast model; |
36 | m.addElement(myTag); |
37 | } |
38 | } |
39 | } |
40 | } |
41 | } |
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001374 |
Snippet name: | Add Kilroy to JList (code for injection) |
Eternal ID of this version: | #1001374/1 |
Text MD5: | 78302cd745ae10b83583d545ce5880e1 |
Transpilation MD5: | ad21b761ebc15c39a74f950c37fbe8ef |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-11-01 13:39:43 |
Source code size: | 1181 bytes / 41 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 785 / 1076 |
Referenced in: | [show references] |