Are you trying?
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.event.*;
import rsbot.table.*;
import com.speljohan.rsbot.bot.Bot;
import com.speljohan.rsbot.event.listeners.PaintListener;
import com.speljohan.rsbot.script.Script;
import com.speljohan.rsbot.script.wrappers.*;
public class InterfaceExplorer extends Script {
private HighlightInterface highlightInterface;
private JTreeTable table;
private InterfaceModel interfaceModel;
public InterfaceExplorer() {
LOG_SRC = "Interface Explr";
}
public String getAuthor() {
return "BAsh";
}
public String getName() {
return "Interface Explorer";
}
public double getVersion() {
return 2;
}
public String getScriptDescription() {
return "<html>\n"
+ "<head></head>\n"
+ "<body>\n"
+ "<center>"
+ "<h2>"
+ getName()
+ "</h2>"
+ "</center>\n"
+ "<p\n"
+ "<b>Author:</b> "
+ getAuthor()
+ "<p>\n"
+ "<b>Version:</b> "
+ getVersion()
+ "<p>\n"
+ "This script starts a window that allows the interfaces to be examined.\n<p>"
+ "The main tree of numbers are indexes for the parent interface: "
+ "RSInterface.getInterface([main]) <br>The subtrees are indexes of the child interfaces: "
+ "RSInterface.getInterface([main]).getChild([child]) or "
+ "RSInterface.getChildInterface([main],[child])\n<p>"
+ "A box is drawn on the main screen indicating where the interface is."
+ "</body>\n" + "</html>";
}
public String getScriptCategory() {
return "Development";
}
public int loop() {
// moveMouse(random(0, 765),random(0, 503));
// return random(1000,1500);
return -1;
}
public void cleanup() {
Bot.getEventManager().removeListener(PaintListener.class,
highlightInterface);
}
private class HighlightInterface implements ListSelectionListener,
PaintListener {
private Object select;
public void valueChanged(ListSelectionEvent e) {
int selected = table.getSelectedRow();
if (selected != -1) {
select = table.getTree().getPathForRow(selected)
.getLastPathComponent();
} else {
select = null;
}
}
public void onRepaint(Graphics render) {
if (select instanceof RSInterfaceChild) {
RSInterfaceChild inter = (RSInterfaceChild) select;
if (inter.isValid()) {
Rectangle rect = inter.getArea();
render.setColor(Color.ORANGE);
render.drawRect(rect.x, rect.y, rect.width, rect.height);
}
}
}
}
public boolean onStart(Map<String, String> map) {
final JFrame frame = new JFrame(
"Interface Explorer by BAsh LOL AFTERMATH WAS HERE OMGGGGGG GUN00000T");
interfaceModel = new InterfaceModel();
highlightInterface = new HighlightInterface();
Bot.getEventManager().addListener(PaintListener.class,
highlightInterface);
JButton button = new JButton("Update");
JButton search = new JButton("Search...");
JButton removeFilters = new JButton("Remove Filters");
JPanel buttonPanel = new JPanel(new FlowLayout());
buttonPanel.add(button);
buttonPanel.add(search);
buttonPanel.add(removeFilters);
final ActionListener al = new ActionListener() {
JScrollPane scroll;
public void actionPerformed(ActionEvent e) {
interfaceModel.load();
if (scroll != null) {
frame.remove(scroll);
}
table = new JTreeTable(interfaceModel);
table.getSelectionModel().addListSelectionListener(
highlightInterface);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
scroll = new JScrollPane(table);
frame.add(scroll, BorderLayout.CENTER);
frame.pack();
}
};
removeFilters.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
interfaceModel.search = "";
al.actionPerformed(null);
}
});
search.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String search = JOptionPane.showInputDialog(frame,
"Whaddaya wanna search for? :3",
"Quest for the holy grail!",
JOptionPane.QUESTION_MESSAGE);
if (search == null) {
interfaceModel.search = "";
} else {
interfaceModel.search = search;
}
al.actionPerformed(null);
}
});
al.actionPerformed(null);
button.addActionListener(al);
frame.add(buttonPanel, BorderLayout.SOUTH);
frame.setResizable(true);
frame.pack();
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
cleanup();
}
});
return true;
}
private static class InterfaceModel extends AbstractTreeTableModel {
String search = "";
private String[] cNames = new String[] { "Index", "Action", "Type",
"ModelID", "Text", "Actions", "Inventory" };
private List<RSInterface> inters = new ArrayList<RSInterface>();
public InterfaceModel() {
super(null);
root = this;
}
public void load() {
inters.clear();
RSInterface[] array = RSInterface.getAllInterfaces();
for (RSInterface inter : array) {
RSInterfaceChild[] children = inter.getChildren();
for (RSInterfaceChild child : children) {
if (child.getText().toLowerCase().contains(
search.toLowerCase())) {
;
inters.add(inter);
break;
}
}
}
}
public int getColumnCount() {
return cNames.length;
}
public String getColumnName(int column) {
return cNames[column];
}
public Object getValueAt(Object node, int column) {
if (node instanceof InterfaceModel) {
return column == 0 ? "Root" : "";
}
if (node instanceof RSInterface) {
RSInterface n = (RSInterface) node;
return column == 0 ? "[" + n.getIndex() + "]" : "";
}
if (node instanceof RSInterfaceChild) {
RSInterfaceChild n = (RSInterfaceChild) node;
switch (column) {
case 0:
return "[" + n.getIndex() + "]";
case 1:
return n.getActionType();
case 2:
return n.getType();
case 3:
return n.getModelID();
case 4:
return n.getText();
case 5:
return Arrays.toString(n.getActions());
case 6:
return Arrays.toString(n.getInventory());
}
}
return null;
}
public Object getChild(Object node, int index) {
if (node instanceof InterfaceModel) {
return inters.get(index);
}
if (node instanceof RSInterface) {
RSInterface n = (RSInterface) node;
return n.getChild(index);
}
return null;
}
public int getChildCount(Object node) {
if (node instanceof InterfaceModel) {
return inters.size();
}
if (node instanceof RSInterface) {
RSInterface n = (RSInterface) node;
return n.getChildCount();
}
return 0;
}
}
}
No.
Although if you want to maximize the ease of ripping that, you could like reverse KYAB, make SCAR send the shit to the GUI program.