azn2000 Posted January 21, 2019 Share Posted January 21, 2019 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); } } 5 Quote Link to comment Share on other sites More sharing options...
liverare Posted January 22, 2019 Share Posted January 22, 2019 (edited) 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, 2019 by liverare 1 Quote Link to comment Share on other sites More sharing options...
azn2000 Posted January 22, 2019 Author Share Posted January 22, 2019 I'm new to java and more to the java gui, nice one you got there That's pretty cool. Quote Link to comment Share on other sites More sharing options...
Juggles Posted January 22, 2019 Share Posted January 22, 2019 Interesting idea actually. Nice work! Quote Link to comment Share on other sites More sharing options...
Durky Posted January 29, 2019 Share Posted January 29, 2019 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). Quote Link to comment Share on other sites More sharing options...