Jump to content

SRSYL wtf JFormDesigner


Recommended Posts

Posted (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 by Paradox68
Posted

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.

Posted

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):

 

f908f7b77a.png

 

 

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

Posted

Works fine for me when I run it (not on OSBot):

 

f908f7b77a.png

 

 

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.

Posted (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 by Explv

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...