January 21, 20197 yr I needed a easy way to track which bot is running which account, so yeah. You can change the Title and the icon with this. Have fun Spoiler import sun.swing.SwingAccessor; import javax.swing.*; import java.awt.*; import java.awt.image.*; public class OSBotBar { private static Image iconNormal; private static Image iconRed; private static Image iconGreen; private static JFrame frame; private static String title; public static void setTitle(String name){ if(frame == null) getFrame(); if(title == null) title = frame.getTitle(); if (frame != null) { frame.setTitle(title + " - " + name); } } public static void setIcon(Icon icon){ if(iconNormal == null || iconRed == null || iconGreen == null) getIcons(); switch (icon){ case GREEN: frame.setIconImage(iconGreen); break; case RED: frame.setIconImage(iconRed); break; default: frame.setIconImage(iconNormal); } } private static void getIcons(){ if(frame == null) getFrame(); iconNormal = frame.getIconImage(); ImageProducer prodRed = new FilteredImageSource( iconNormal.getSource(), new ColorFilter(0xffff0000) ); ImageProducer prodGreen = new FilteredImageSource( iconNormal.getSource(), new ColorFilter(0xff00ff00) ); iconRed = frame.createImage(prodRed); iconGreen = frame.createImage(prodGreen); } private static void getFrame(){ Window[] windows = Window.getWindows(); for (Window window : windows) { if (window instanceof JFrame) { JFrame jFrame = (JFrame) window; if (jFrame != null && jFrame.getTitle().contains("OSBot ")) { frame = jFrame; } } } } public enum Icon{ STANDARD, RED, GREEN } } class ColorFilter extends RGBImageFilter { private int filter; public ColorFilter(int filter) { this.filter = filter; canFilterIndexColorModel = true; } public int filterRGB( int x, int y, int rgb ) { return (rgb & filter); } }
January 22, 20197 yr Nice work. Also, you don't need to use getFrame when you can do: Window w = SwingUtilities.getWindowAncestor(bot.getCanvas()); JFrame f = (JFrame) w; f.setTitle("TEST"); Edited January 22, 20197 yr by liverare
January 22, 20197 yr Author I'm new to java and more to the java gui, nice one you got there ? That's pretty cool.
January 29, 20197 yr This is an awesome idea, nicely done. since with java 10 you can break down the Main java process to display the child process names, you could manually set it to "runelite" and maybe help avoid the "auto detection system" (if they ever coded one to check child processes, I've yet to see it in an OSRS deob).
Create an account or sign in to comment