Jump to content

Gui Checkbox for Banking or Dropping


mark jacobs

Recommended Posts

Just getting back into scripting. Trying to learn how to implement a GUI checkbox for which the user can select if they wish to bank or drop items. I have my GUI panel made, I just cannot figure out how to pass data from my GUI class, Main class, and drop/bank class task. If anyone can point me in the right direction! or has tips! please let me know! Thanks greatly in advance!!!

 

 

Link to comment
Share on other sites

1 minute ago, Gunman said:

@mark jacobs Are you asking how to make a check box? Or are you asking how to determine the logic of banking and dropping based on this checkbox?

The logic behind it. My GUI design is there, the logic part is what I am struggling with. Here is what I have so far that is not quite working:

Gui class variables

private boolean DropToggle;
private JCheckBox DropCheckBox;

Gui class Checkbox

//Dropping Check Box
            DropCheckBox = new JCheckBox("Drop?");
            DropCheckBox.setFont(new Font("Sans Serif", Font.BOLD, 15));
            DropCheckBox.setBounds(53, 285, 150, 20);
            settingsPanel.add(DropCheckBox);
            DropCheckBox.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        DropCheckBox.setSelected(true);
                        DropToggle = true;
                    }
                });

Gui Call method

public boolean isDropBoxChecked(){
        return DropToggle;
    }

Main class OnSstart

 if(gui.isDropBoxChecked()){
            tasks.add(new DropFish(this));
        }

Drop task

 

public class DropFish extends Task{

    private boolean dropItemsEnabled;

    public DropFish(EioFisher script) {
        super(script);
    }


    @Override
    public boolean canProcess() throws InterruptedException {
        return script.inventory.isFull();
    }

    @Override
    public void process() throws InterruptedException {
        script. currentState = Status.DROPPING;

        script.inventory.dropAllExcept("Small fishing net");
    }
}

When I check the box it does nothing.

 

And here is a visual of my GUI design

2acdea7f3abd0a5518a3fe8c3f48221a.png

I still have to work on the other sections, but I was starting with figuring out the dropping and banking first before I even tried the Type, Tool, and Location.

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...