Jump to content
Qubit

Passing inventory.getItems() into my gui class

Recommended Posts

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

4yAuIIr.png

Edited by javant
Link to comment
Share on other sites

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

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