Reputation: 11
I'm a little bit of a netbeans GUI noob so please bear with me.
I have written a program with multiple classes containing methods which I want to 'link' to buttons in a GUI. I had these classes written before I created my GUI form using the netbeans GUI builder. It is very restrictive at times in terms of what it will let me add/remove.
I have a form, and within its main method I have called an instance of a class which itself creates an array of 200 'frames' (another class type I have created). Lets call the instance of this class 'dM'. I would like to be able to call dM.method(); however it keeps telling me that the package dM does not exist.
I would be satisfied with even a general explanation as to how i could add calls to these methods withing my generated event methods in the GUI form.
Any suggestions are much appreciated.
Upvotes: 1
Views: 1980
Reputation: 897
Have you tried using the Model-View-Controller design pattern to solve this? It's a little complex, but it will allow you to decouple the GUI from calling actual methods (the calling can be done in the controller).
Check out: Wikipedia's Explanation
There are also some good external links, for example, to the Portland Pattern Repository.
Additionally, you could use listeners to call methods on your classes based on actions in your GUI.
This answer is very broad, but I would need more details/code for your implementation to give any help tailored specifically to your case.
Upvotes: 1