Paradox68 Posted January 9, 2016 Share Posted January 9, 2016 (edited) I have never had any issues in the past developing with JformDesigner but now whenever I create a GUI with it, the script will not load. @Override public void onStart() throws InterruptedException { UI gui = new UI(); gui.setVisible(true); while (gui.isVisible()) { sleep(100); } getExperienceTracker().start(Skill.FISHING); timeStart = System.currentTimeMillis(); } and a pastebin for the GUI code: http://pastebin.com/CRgidXqW I had Explv helping me with the same problem on a different script, not even he could figure out why it's doing this. OSBot @Devs pls. Edited January 9, 2016 by Paradox68 Quote Link to comment Share on other sites More sharing options...
GoldenGates Posted January 9, 2016 Share Posted January 9, 2016 (edited) Now will you consider my advice? Edit: Are you saying the script as a whole doesn't start or just the GUI doesn't show. And do you notice any CPU spikes? Edited January 9, 2016 by GoldenGates Quote Link to comment Share on other sites More sharing options...
KEVzilla Posted January 9, 2016 Share Posted January 9, 2016 Need to see the UI class. Are you using #dispose? Quote Link to comment Share on other sites More sharing options...
Paradox68 Posted January 9, 2016 Author Share Posted January 9, 2016 Need to see the UI class. Are you using #dispose? Dispose is for the button click method. UI class is in the pastebin link in original post. Now will you consider my advice? Edit: Are you saying the script as a whole doesn't start or just the GUI doesn't show. And do you notice any CPU spikes? If I remove the GUI the script runs normally so I know the GUI is causing it, but symptom is that the script instantly stops itself when I run it. Quote Link to comment Share on other sites More sharing options...
KEVzilla Posted January 9, 2016 Share Posted January 9, 2016 What if you move the while loop into the overridden onLoop method? Quote Link to comment Share on other sites More sharing options...
Paradox68 Posted January 9, 2016 Author Share Posted January 9, 2016 What if you move the while loop into the overridden onLoop method? Nope. By all accounts none of this follows any form of logic. Quote Link to comment Share on other sites More sharing options...
Explv Posted January 9, 2016 Share Posted January 9, 2016 I have never had any issues in the past developing with JformDesigner but now whenever I create a GUI with it, the script will not load. @Override public void onStart() throws InterruptedException { UI gui = new UI(); gui.setVisible(true); while (gui.isVisible()) { sleep(100); } getExperienceTracker().start(Skill.FISHING); timeStart = System.currentTimeMillis(); } and a pastebin for the GUI code: http://pastebin.com/CRgidXqW I had Explv helping me with the same problem on a different script, not even he could figure out why it's doing this. OSBot @Devs pls. Works fine for me when I run it (not on OSBot): The only thing I had to remove was: label1.setIcon(new ImageIcon(getClass().getResource("/title.png")); because I don't have the image obviously. Perhaps you are getting an NPE because one of the image locations is wrong Quote Link to comment Share on other sites More sharing options...
Paradox68 Posted January 9, 2016 Author Share Posted January 9, 2016 Works fine for me when I run it (not on OSBot): The only thing I had to remove was: label1.setIcon(new ImageIcon(getClass().getResource("/title.png")); because I don't have the image obviously. Perhaps you are getting an NPE because one of the image locations is wrong How do I make it so an image is kept in the GUI (the .jar) so that other people can load it when they use the script? I thought it was to put it in classpath...? Also it seems to work when I remove the image and change the font of the header. Quote Link to comment Share on other sites More sharing options...
Explv Posted January 9, 2016 Share Posted January 9, 2016 (edited) How do I make it so an image is kept in the GUI (the .jar) so that other people can load it when they use the script? I thought it was to put it in classpath...? Also it seems to work when I remove the image and change the font of the header. You should place the image inside of a folder called "resources". This folder should be placed within src You then load the image using: private void initComponents() { Image image = getImage("title.png"); if(image != null) label1.setIcon(new ImageIcon(image)); } private Image getImage(String imageName){ try{ return ImageIO.read(TutorialIsland.class.getResourceAsStream("/resources/" + imageName)); } catch(IOException e){ } return null; } Edited January 9, 2016 by Explv Quote Link to comment Share on other sites More sharing options...