May 12, 20232 yr 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!!!
May 12, 20232 yr @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?
May 12, 20232 yr Author 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 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.
May 13, 20232 yr You don't need to add that action for the checkbox, as to why it wouldn't work I am unsure from the information present
Create an account or sign in to comment