Jump to content

SRSYL wtf JFormDesigner


Paradox68

Recommended Posts

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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