I have 2 modules: BrowserLibrary and BrowserViewer.
Browser contains gui like any browser should.
so inside BrowserLibrary module I have a class like so:
public class BrowserController implements ActionListener{
public void actionPerformed(ActionEvent e) {
if (e.getSource().getVarName() == "navButton")
System.out.println("clicked");
}
}
and in BrowserViewer module's BrowserTopComponent.java:
private javax.swing.JButton navButton;
navButton.addActionListener(BrowserController);
I am not sure if this is the right design I should be pursuing. Should BrowserLibrary only be used to load the 3rd party JARs and nothing else ? IF that is the case would I end up with 3 modules: BrowserLibrary, Browser, BrowserViewer ? How would the dependencies work in this case ? Does Browser depend on BrowserLibrary, and BrowserViewer depend on Browser ?
So inside Browser module, I would have BrowserController class which implements ActionListener ?
Also how can I get the variable name of the e.getSource() object ? in this case "navButton" is the variable name of the JButton.
Should I be using Lookups ? How would that be incorporated here ?