Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 927643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:53:08+00:00 2026-05-15T19:53:08+00:00

I have 2 modules: BrowserLibrary and BrowserViewer. Browser contains gui like any browser should.

  • 0

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 ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:53:09+00:00Added an answer on May 15, 2026 at 7:53 pm

    The number and composition of modules should reflect the modularity of your design. A good question to ask is “Can this module be reused without the others?” If the answer is no, then the modules in question are tightly coupled and should probably only be one module. For example, a module that handles the HTTP protocol could be used independently of the browser. The actions for navigating in a browser are probably rather browser centric and probably cannot be used by themselves.

    Variables are run time instances, but variable names are really compile-time artifacts that programmers use to refer to a variable. That said, all swing components do have a name property that can be used for identification. Do note that it is the developer;s responsibility to ensure uniqueness.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok I have two modules, each containing a class, the problem is their classes
I have Excel add-in which I add so many class modules that it is
I have a few modules of block of code in VBA to run on
I have written a few modules of code in Access vba. Each code runs
I have around ~40 custom modules and a custom skin on a DotNetNuke site
I have a large application (~50 modules) using a structure similar to the following:
Anyone have suggestions for deployment methods for Perl modules to a share nothing cluster?
I have a bunch of Python modules in a directory, all being a derivate
I have a .exe and many plug-in .dll modules that the .exe loads. (I
I have a very large codebase (read: thousands of modules) that has code shared

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.