Qubit Posted May 19, 2015 Posted May 19, 2015 (edited) I created a gui class for my script. The only problem is I have a button in the gui that uses an action listener class that when pressed calls inventory.getItems() .. but it tells me that inventory is not a defined variable.. how would I pass the items[] into the gui when my button is called... yes i know it is not supposed to say sout, it is used for a debug in the main .. yes i will change it to log later Edited May 19, 2015 by javant
Apaec Posted May 19, 2015 Posted May 19, 2015 MyGUI g = new MyGUI(Script script); put script as one of the parameters... then just call script.inventory.getItems()
Qubit Posted May 19, 2015 Author Posted May 19, 2015 GetInventory(). method is undefined MyGUI g = new MyGUI(Script script); put script as one of the parameters... then just call script.inventory.getItems() script.getInventory().getItems() worked will that complete the same task.? Thank you soo much!
Apaec Posted May 19, 2015 Posted May 19, 2015 script.getInventory().getItems() worked will that complete the same task.? Thank you soo much! yes. GetInventory(). It has no way of relating to the jar build path so this wouldn't work either without proper implementation
Khaleesi Posted May 19, 2015 Posted May 19, 2015 (edited) You have to pass the script object to if you want to acces it's methods, since we are not using a static API here. The only reason you don't have to do that in the main class is because you extended your mainclass with the Script object. Khaleesi Just do this in main class: GUI gui = new GUI(this); gui.setVisible(true); At GUI: script.inventory.getItem("APA's mom <3"); Enjoy! Edited May 19, 2015 by Khaleesi