forked from crazyeyes-pb/Scripts
/
InterfaceExplorer.java
699 lines (634 loc) · 24.9 KB
/
InterfaceExplorer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.wrappers.RSComponent;
import org.rsbot.script.wrappers.RSInterface;
import javax.swing.*;
import javax.swing.event.TreeModelEvent;
import javax.swing.event.TreeModelListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ScriptManifest(authors = {"Iscream", "joku.rules"}, keywords = "Development", name = "Interface Explorer", version = 0.5, description = "Fetches various interface data for developers.", requiresVersion = 244)
public class InterfaceExplorer extends Script implements PaintListener {
private class HighLightInterface {
private RSInterface parent = null;
private RSComponent child = null;
private RSComponent component = null;
private final int change;
HighLightInterface(final RSInterface a, final RSComponent b, final RSComponent c, final int change) {
parent = a;
child = b;
component = c;
this.change = change;
}
private int getChange() {
return change;
}
private RSComponent getChild() {
return child;
}
private RSComponent getComp() {
return component;
}
private RSInterface getParent() {
return parent;
}
}
@SuppressWarnings("serial")
private class HighlightTreeCellRenderer extends DefaultTreeCellRenderer {
public final ArrayList<HighLightInterface> HighLightableWraps = new ArrayList<HighLightInterface>();
private HighLightInterface NextInterface;
private final TreeCellRenderer renderer;
public HighlightTreeCellRenderer(final TreeCellRenderer renderer) {
this.renderer = renderer;
}
@Override
public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean isSelected, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) {
final JComponent c = (JComponent) renderer.getTreeCellRendererComponent(tree, value, isSelected, expanded, leaf, row, hasFocus);
HighLightableWraps.clear();
HighLightableWraps.addAll(HighLightWraps);
if (value instanceof RSInterfaceWrap) {
for (int i = 0; i < HighLightableWraps.size(); i++) {
NextInterface = HighLightableWraps.get(i);
if (NextInterface.getComp() == null) {
if (NextInterface.getChild().getInterface().getIndex() == ((RSInterfaceWrap) value).wrapped.getIndex()) {
c.setForeground(Color.blue);
}
}
}
}
if (value instanceof RSComponentWrap) {
for (int i = 0; i < HighLightableWraps.size(); i++) {
NextInterface = HighLightableWraps.get(i);
if (NextInterface.getComp() == null) {
if (NextInterface.getChild().getInterface().getIndex() == ((RSComponentWrap) value).wrapped.getInterface().getIndex()) {
if (NextInterface.getChild().getIndex() == ((RSComponentWrap) value).wrapped.getIndex()) {
c.setForeground(Color.blue);
}
}
} else {
if (NextInterface.getChild().getIndex() == ((RSComponentWrap) value).wrapped.getParent().getIndex() && NextInterface.getParent().getIndex() == ((RSComponentWrap) value).wrapped.getParent().getInterface().getIndex()) {
c.setForeground(Color.blue);
}
}
}
}
return c;
}
}
private class InterfaceTreeModel implements TreeModel {
private final Object root = new Object();
private final ArrayList<TreeModelListener> treeModelListeners = new ArrayList<TreeModelListener>();
private final ArrayList<RSInterfaceWrap> interfaceWraps = new ArrayList<RSInterfaceWrap>();
public void addTreeModelListener(final TreeModelListener l) {
treeModelListeners.add(l);
}
private void fireTreeStructureChanged(final Object oldRoot) {
treeModelListeners.size();
final TreeModelEvent e = new TreeModelEvent(this, new Object[]{oldRoot});
for (final TreeModelListener tml : treeModelListeners) {
tml.treeStructureChanged(e);
}
}
public Object getChild(final Object parent, final int index) {
if (parent == root) {
return interfaceWraps.get(index);
} else if (parent instanceof RSInterfaceWrap) {
return new RSComponentWrap(((RSInterfaceWrap) parent).wrapped.getComponents()[index]);
} else if (parent instanceof RSComponentWrap) {
return new RSComponentWrap(((RSComponentWrap) parent).wrapped.getComponents()[index]);
}
return null;
}
public int getChildCount(final Object parent) {
if (parent == root) {
return interfaceWraps.size();
} else if (parent instanceof RSInterfaceWrap) {
return ((RSInterfaceWrap) parent).wrapped.getComponents().length;
} else if (parent instanceof RSComponentWrap) {
return ((RSComponentWrap) parent).wrapped.getComponents().length;
}
return 0;
}
public int getIndexOfChild(final Object parent, final Object child) {
if (parent == root) {
return interfaceWraps.indexOf(child);
} else if (parent instanceof RSInterfaceWrap) {
return Arrays.asList(((RSInterfaceWrap) parent).wrapped.getComponents()).indexOf(((RSComponentWrap) child).wrapped);
} else if (parent instanceof RSComponentWrap) {
return Arrays.asList(((RSComponentWrap) parent).wrapped.getComponents()).indexOf(((RSComponentWrap) child).wrapped);
}
return -1;
}
public Object getRoot() {
return root;
}
public boolean isLeaf(final Object o) {
return o instanceof RSComponentWrap && ((RSComponentWrap) o).wrapped.getComponents().length == 0;
}
public void removeTreeModelListener(final TreeModelListener l) {
treeModelListeners.remove(l);
}
public boolean searchMatches(final RSComponent iface, final String contains) {
return iface.getText().toLowerCase().contains(contains.toLowerCase());
}
public void update(final String search) {
interfaceWraps.clear();
HighLightWraps.clear();
for (final RSInterface iface : interfaces.getAll()) {
toBreak:
for (final RSComponent child : iface.getComponents()) {
if (searchMatches(child, search)) {
interfaceWraps.add(new RSInterfaceWrap(iface));
if (window.isVisible() && !listenerButton.isSelected() && !searchBox.getText().equals("")) {
HighLightWraps.add(new HighLightInterface(iface, child, null, -1));
}
break;
}
for (final RSComponent component : child.getComponents()) {
if (searchMatches(component, search)) {
interfaceWraps.add(new RSInterfaceWrap(iface));
if (window.isVisible() && !listenerButton.isSelected() && !searchBox.getText().equals("")) {
HighLightWraps.add(new HighLightInterface(iface, child, component, -1));
}
break toBreak;
}
}
}
}
fireTreeStructureChanged(root);
}
public void valueForPathChanged(final TreePath path, final Object newValue) {
}
}
private class RSComponentListener {
int type;
int specialtype;
int bounds;
int model;
int color;
int getID;
String getText;
String tooltip;
String selectionname;
int compID;
int compStackSize;
Point relativeloc;
Point absoluteloc;
Rectangle area;
int xRot, yRot, zRot;
RSComponent a;
RSComponentListener(final RSComponent child) {
a = child;
type = child.getType();
specialtype = child.getSpecialType();
bounds = child.getBoundsArrayIndex();
model = child.getModelID();
color = child.getBackgroundColor();
getID = child.getParentID();
getText = child.getText();
tooltip = child.getTooltip();
selectionname = child.getSelectedActionName();
compID = child.getComponentID();
compStackSize = child.getComponentStackSize();
relativeloc = new Point(child.getRelativeX(), child.getRelativeY());
absoluteloc = new Point(child.getAbsoluteX(), child.getAbsoluteY());
area = child.getArea();
xRot = child.getXRotation();
yRot = child.getYRotation();
zRot = child.getZRotation();
}
private int getXRotation() {
return xRot;
}
private int getYRotation() {
return yRot;
}
private int getZRotation() {
return zRot;
}
private int bounds() {
return bounds;
}
private int getAbsoluteX() {
return absoluteloc.x;
}
private int getAbsoluteY() {
return absoluteloc.y;
}
private int getColor() {
return color;
}
private int getCompID() {
return compID;
}
private RSComponent getComponent() {
return a;
}
private int getCompSize() {
return compStackSize;
}
private int getID() {
return getID;
}
private int getModelID() {
return model;
}
private int getRelativeX() {
return relativeloc.x;
}
private int getRelativeY() {
return relativeloc.y;
}
private String getSelectionName() {
return selectionname;
}
private int getSpecialType() {
return specialtype;
}
private String getText() {
return getText;
}
private String getToolTip() {
return tooltip;
}
private int getType() {
return type;
}
public Rectangle getArea() {
return area;
}
}
private class RSComponentWrap {
public RSComponent wrapped;
public RSComponentWrap(final RSComponent wrapped) {
this.wrapped = wrapped;
}
@Override
public boolean equals(final Object o) {
return o instanceof RSComponentWrap && wrapped == ((RSComponentWrap) o).wrapped;
}
@Override
public String toString() {
return "Component " + wrapped.getIndex();
}
}
private class RSInterfaceWrap {
public RSInterface wrapped;
public RSInterfaceWrap(final RSInterface wrapped) {
this.wrapped = wrapped;
}
@Override
public boolean equals(final Object o) {
return o instanceof RSInterfaceWrap && wrapped == ((RSInterfaceWrap) o).wrapped;
}
@Override
public String toString() {
return "Interface " + wrapped.getIndex();
}
}
private class threadlistener implements Runnable {
public threadlistener() {
new Thread(this).start();
}
public void kill() {
Thread.interrupted();
}
public void run() {
try {
while (isRunning() && listenerButton.isSelected()) {
for (int i = 0; i < OldInterfaces.size(); i++) {
compare(OldInterfaces.get(i));
}
Thread.sleep(100);
}
} catch (final InterruptedException e) {
e.printStackTrace();
}
}
}
private final ArrayList<HighLightInterface> HighLightWraps = new ArrayList<HighLightInterface>();
private final ArrayList<RSComponentListener> OldInterfaces = new ArrayList<RSComponentListener>();
threadlistener o = null;
private int change = -1;
private Rectangle highlightArea = null;
private HighlightTreeCellRenderer renderer = null;
private JFrame window;
private JTree tree;
private InterfaceTreeModel treeModel;
private JPanel infoArea;
private JTextField searchBox;
final JToggleButton listenerButton = new JToggleButton("Listen");
private void addOldComponent() {
OldInterfaces.clear();
for (final RSInterface iface : interfaces.getAll()) {
for (final RSComponent child : iface.getComponents()) {
OldInterfaces.add(new RSComponentListener(child));
if (child.getComponentStackSize() != 0) {
for (final RSComponent component : child.getComponents()) {
OldInterfaces.add(new RSComponentListener(component));
}
}
}
}
}
public void check() {
if (listenerButton.isSelected()) {
addOldComponent();
}
o = new threadlistener();
}
private void compare(final RSComponentListener a) {
if (a.getComponent().getType() != a.getType()) {
if (a.getComponent().getParent() == null) {
HighLightWraps.add(new HighLightInterface(a.getComponent().getInterface(), a.getComponent(), null, 1));
} else {
HighLightWraps.add(new HighLightInterface(a.getComponent().getParent().getInterface(), a.getComponent().getParent(), a.getComponent(), 1));
}
}
if (a.getComponent().getSpecialType() != a.getSpecialType()) {
if (a.getComponent().getParent() == null) {
HighLightWraps.add(new HighLightInterface(a.getComponent().getInterface(), a.getComponent(), null, 2));
} else {
HighLightWraps.add(new HighLightInterface(a.getComponent().getParent().getInterface(), a.getComponent().getParent(), a.getComponent(), 2));
}
}
if (a.getComponent().getBoundsArrayIndex() != a.bounds()) {
if (a.getComponent().getParent() == null) {
HighLightWraps.add(new HighLightInterface(a.getComponent().getInterface(), a.getComponent(), null, 3));
} else {
HighLightWraps.add(new HighLightInterface(a.getComponent().getParent().getInterface(), a.getComponent().getParent(), a.getComponent(), 3));
}
}
if (a.getComponent().getModelID() != a.getModelID()) {
if (a.getComponent().getParent() == null) {
HighLightWraps.add(new HighLightInterface(a.getComponent().getInterface(), a.getComponent(), null, 4));
} else {
HighLightWraps.add(new HighLightInterface(a.getComponent().getParent().getInterface(), a.getComponent().getParent(), a.getComponent(), 4));
}
}
if (a.getComponent().getBackgroundColor() != a.getColor()) {
if (a.getComponent().getParent() == null) {
HighLightWraps.add(new HighLightInterface(a.getComponent().getInterface(), a.getComponent(), null, 5));
} else {
HighLightWraps.add(new HighLightInterface(a.getComponent().getParent().getInterface(), a.getComponent().getParent(), a.getComponent(), 5));
}
}
if (a.getComponent().getParentID() != a.getID()) {
if (a.getComponent().getParent() == null) {
HighLightWraps.add(new HighLightInterface(a.getComponent().getInterface(), a.getComponent(), null, 6));
} else {
HighLightWraps.add(new HighLightInterface(a.getComponent().getParent().getInterface(), a.getComponent().getParent(), a.getComponent(), 6));
}
}
if (a.getComponent().getText() != a.getText()) {
if (a.getComponent().getParent() == null) {
HighLightWraps.add(new HighLightInterface(a.getComponent().getInterface(), a.getComponent(), null, 7));
} else {
HighLightWraps.add(new HighLightInterface(a.getComponent().getParent().getInterface(), a.getComponent().getParent(), a.getComponent(), 7));
}
}
if (a.getComponent().getTooltip() != a.getToolTip()) {
if (a.getComponent().getParent() == null) {
HighLightWraps.add(new HighLightInterface(a.getComponent().getInterface(), a.getComponent(), null, 8));
} else {
HighLightWraps.add(new HighLightInterface(a.getComponent().getParent().getInterface(), a.getComponent().getParent(), a.getComponent(), 8));
}
}
if (a.getComponent().getSelectedActionName() != a.getSelectionName()) {
if (a.getComponent().getParent() == null) {
HighLightWraps.add(new HighLightInterface(a.getComponent().getInterface(), a.getComponent(), null, 9));
} else {
HighLightWraps.add(new HighLightInterface(a.getComponent().getParent().getInterface(), a.getComponent().getParent(), a.getComponent(), 9));
}
}
if (a.getComponent().getComponentID() != a.getCompID()) {
if (a.getComponent().getParent() == null) {
HighLightWraps.add(new HighLightInterface(a.getComponent().getInterface(), a.getComponent(), null, 11));
} else {
HighLightWraps.add(new HighLightInterface(a.getComponent().getParent().getInterface(), a.getComponent().getParent(), a.getComponent(), 11));
}
}
if (a.getComponent().getComponentStackSize() != a.getCompSize()) {
if (a.getComponent().getParent() == null) {
HighLightWraps.add(new HighLightInterface(a.getComponent().getInterface(), a.getComponent(), null, 12));
} else {
HighLightWraps.add(new HighLightInterface(a.getComponent().getParent().getInterface(), a.getComponent().getParent(), a.getComponent(), 12));
}
}
if (a.getComponent().getRelativeX() != a.getRelativeX() || a.getComponent().getRelativeY() != a.getRelativeY()) {
if (a.getComponent().getParent() == null) {
HighLightWraps.add(new HighLightInterface(a.getComponent().getInterface(), a.getComponent(), null, 13));
} else {
HighLightWraps.add(new HighLightInterface(a.getComponent().getParent().getInterface(), a.getComponent().getParent(), a.getComponent(), 13));
}
}
if (a.getComponent().getAbsoluteX() != a.getAbsoluteX() || a.getComponent().getAbsoluteY() != a.getAbsoluteY()) {
if (a.getComponent().getParent() == null) {
HighLightWraps.add(new HighLightInterface(a.getComponent().getInterface(), a.getComponent(), null, 14));
} else {
HighLightWraps.add(new HighLightInterface(a.getComponent().getParent().getInterface(), a.getComponent().getParent(), a.getComponent(), 14));
}
}
if (a.getComponent().getArea() != null && a.getArea() != null && a.getComponent().getArea().getSize().equals(a.getArea().getSize())) {
HighLightWraps.add(new HighLightInterface(a.getComponent().getParent().getInterface(), a.getComponent().getParent(), a.getComponent(), 15));
}
if (a.getComponent().getXRotation() != a.getXRotation() || a.getComponent().getYRotation() != a.getYRotation() || a.getComponent().getZRotation() != a.getZRotation()) {
HighLightWraps.add(new HighLightInterface(a.getComponent().getParent().getInterface(), a.getComponent().getParent(), a.getComponent(), 16));
}
}
@Override
public int loop() {
if (window.isVisible()) {
return 1000;
}
return -1;
}
@Override
public void onFinish() {
o.kill();
}
public void onRepaint(final Graphics g) {
if (highlightArea != null) {
g.setColor(Color.ORANGE);
g.drawRect(highlightArea.x, highlightArea.y, highlightArea.width, highlightArea.height);
}
}
public void setHighlightArea(Rectangle r) {
this.highlightArea = r;
}
@Override
public boolean onStart() {
window = new JFrame("Interface Explorer");
treeModel = new InterfaceTreeModel();
treeModel.update("");
tree = new JTree(treeModel);
tree.setRootVisible(false);
tree.setEditable(false);
renderer = new HighlightTreeCellRenderer(tree.getCellRenderer());
tree.setCellRenderer(renderer);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.addTreeSelectionListener(new TreeSelectionListener() {
private void addInfo(final String key, final String value, final boolean highlight) {
final JPanel row = new JPanel();
row.setAlignmentX(Component.LEFT_ALIGNMENT);
row.setLayout(new BoxLayout(row, BoxLayout.X_AXIS));
for (final String data : new String[]{key, value}) {
final JLabel label = new JLabel(data);
label.setAlignmentY(Component.TOP_ALIGNMENT);
if (highlight) {
label.setForeground(Color.magenta);
}
row.add(label);
}
infoArea.add(row);
}
public void valueChanged(final TreeSelectionEvent e) {
final Object node = tree.getLastSelectedPathComponent();
if (node == null || node instanceof RSInterfaceWrap) {
return;
}
infoArea.removeAll();
RSComponent iface = null;
if (node instanceof RSComponentWrap) {
iface = ((RSComponentWrap) node).wrapped;
}
if (iface == null) {
return;
}
List<Integer> changes = new ArrayList<Integer>();
for (int i = 0; i < HighLightWraps.size(); i++) {
if (iface.getParent() == null) {
if (HighLightWraps.get(i).getChild().getIndex() == iface.getIndex() && HighLightWraps.get(i).getParent().getIndex() == iface.getInterface().getIndex()) {
changes.add(HighLightWraps.get(i).getChange());
}
} else {
if (HighLightWraps.get(i).getChild().getIndex() == iface.getParent().getIndex() && HighLightWraps.get(i).getParent().getIndex() == iface.getParent().getInterface().getIndex()) {
changes.add(HighLightWraps.get(i).getChange());
}
}
}
addInfo("Type: ", "" + iface.getType(), changes.contains(1));
addInfo("SpecialType: ", "" + iface.getSpecialType(), changes.contains(2));
addInfo("Bounds Index: ", "" + iface.getBoundsArrayIndex(), changes.contains(3));
if (iface.getArea() != null) {
Rectangle size = iface.getArea();
addInfo("Size: ", size.width + "," + size.height, changes.contains(15));
}
addInfo("Model ID: ", "" + iface.getModelID(), changes.contains(4));
addInfo("Texture ID: ", "" + iface.getBackgroundColor(), changes.contains(5));
addInfo("Parent ID: ", "" + iface.getParentID(), changes.contains(6));
addInfo("Text: ", "" + iface.getText(), changes.contains(7));
addInfo("Tooltip: ", "" + iface.getTooltip(), changes.contains(8));
addInfo("SelActionName: ", "" + iface.getSelectedActionName(), changes.contains(9));
if (iface.getActions() != null) {
String actions = "";
for (final String action : iface.getActions()) {
if (!actions.equals("")) {
actions += "\n";
}
actions += action;
}
addInfo("Actions: ", actions, changes.contains(10));
}
addInfo("Component ID: ", "" + iface.getComponentID(), changes.contains(11));
addInfo("Component Stack Size: ", "" + iface.getComponentStackSize(), changes.contains(12));
addInfo("Relative Location: ", "(" + iface.getRelativeX() + "," + iface.getRelativeY() + ")", changes.contains(13));
addInfo("Absolute Location: ", "(" + iface.getAbsoluteX() + "," + iface.getAbsoluteY() + ")", changes.contains(14));
addInfo("Rotation: ", "x: " + iface.getXRotation() + " y: " + iface.getYRotation() + " z: " + iface.getZRotation(), changes.contains(16));
setHighlightArea(iface.getArea());
infoArea.validate();
infoArea.repaint();
}
});
final JDialog Help = new JDialog();
JScrollPane jScrollPane1;
JTextArea jTextArea1;
jScrollPane1 = new JScrollPane();
jTextArea1 = new JTextArea();
Help.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
Help.setTitle("Help");
Help.setResizable(false);
jTextArea1.setColumns(20);
jTextArea1.setEditable(false);
jTextArea1.setFont(new java.awt.Font("MS UI Gothic", 0, 12));
jTextArea1.setLineWrap(true);
jTextArea1.setRows(5);
jTextArea1.setText("Once toggled the listener feature of the interface explorer will detect any changes made to Runescapes interfaces in realtime. If a change is found that interface and data will then be highlighted within the explorers tree model. To use the listener feature you would :\n\n1) Toggle the listener button as active\n2) Wait or commit changes in Runescape\n3) Repaint tree using repaint button or reclick interface folders in GUI\n\n\nTips : While listening for changes the tree model in the GUI will not update itself, changing colors. To refresh the GUI either use the repaint button or close and open Interface folder already within the tree model.");
jTextArea1.setWrapStyleWord(true);
jScrollPane1.setViewportView(jTextArea1);
final GroupLayout layout = new GroupLayout(Help.getContentPane());
Help.getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 348, Short.MAX_VALUE).addContainerGap()));
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 220, GroupLayout.PREFERRED_SIZE).addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
Help.pack();
JScrollPane scrollPane = new JScrollPane(tree);
scrollPane.setPreferredSize(new Dimension(250, 500));
window.add(scrollPane, BorderLayout.WEST);
infoArea = new JPanel();
infoArea.setLayout(new BoxLayout(infoArea, BoxLayout.Y_AXIS));
scrollPane = new JScrollPane(infoArea);
scrollPane.setPreferredSize(new Dimension(250, 500));
window.add(scrollPane, BorderLayout.CENTER);
final ActionListener actionListener = new ActionListener() {
public void actionPerformed(final ActionEvent e) {
treeModel.update(searchBox.getText());
infoArea.removeAll();
infoArea.validate();
infoArea.repaint();
}
};
final ActionListener toggleListener = new ActionListener() {
public void actionPerformed(final ActionEvent e) {
if (listenerButton.isSelected()) {
log("Cleared");
HighLightWraps.clear();
}
check();
}
};
final ActionListener repaintListener = new ActionListener() {
public void actionPerformed(final ActionEvent e) {
log("Refreshed Tree");
treeModel.fireTreeStructureChanged(treeModel.getRoot());
infoArea.removeAll();
infoArea.validate();
infoArea.repaint();
}
};
final ActionListener helpListener = new ActionListener() {
public void actionPerformed(final ActionEvent e) {
Help.setVisible(true);
}
};
final JPanel toolArea = new JPanel();
toolArea.setLayout(new FlowLayout(FlowLayout.LEFT));
toolArea.add(new JLabel("Filter:"));
searchBox = new JTextField(20);
searchBox.addActionListener(actionListener);
toolArea.add(searchBox);
final JButton updateButton = new JButton("Update");
final JButton repaintButton = new JButton("Repaint");
final JButton helpButton = new JButton("Help");
helpButton.addActionListener(helpListener);
listenerButton.addActionListener(toggleListener);
updateButton.addActionListener(actionListener);
repaintButton.addActionListener(repaintListener);
toolArea.add(updateButton);
toolArea.add(listenerButton);
toolArea.add(repaintButton);
toolArea.add(helpButton);
window.add(toolArea, BorderLayout.NORTH);
window.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
window.pack();
window.setVisible(true);
return true;
}
}