May 19, 201510 yr 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, 201510 yr by javant
May 19, 201510 yr MyGUI g = new MyGUI(Script script); put script as one of the parameters... then just call script.inventory.getItems()
May 19, 201510 yr Author 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!
May 19, 201510 yr 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
May 19, 201510 yr 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, 201510 yr by Khaleesi
Create an account or sign in to comment