• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to plugin custom modules in Swing

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am implementing a Swing Application. The system should allow the users to attach custom modules to the application. The custom modules will be developed by third party and will be developed in Swing. The implementation of the custom module is not my concern. I just need to worry about how to attach the custom module with my system.
Could you please suggest me the approach of how to implement this functionality.
A big thanks in advance.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is a "custom module", and what does "attach" mean in that context? Is this a custom Swing component that needs to be displayed as part of the main app somehow?
 
Praveen Sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ulf,
Yes, you are right.
The custom module is a Swing component that should be displayed as a child of the main Application.
It should be menu driven. The component name should be displayed as a menu item and on clicking it the application should load as a child window inside the parent frame.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to think about how the application gets to knows about the available modules; you need a name (that you can display on the GUI) and a classname (for instantiation using Class.forName(...).newInstance()). The modules should implement some common interface, so that the application can initialize them (or have a no-argument constructor that does the initialization). They should also be subclasses of JPanel, so that they can be added to a Swing GUI easily.
 
Ranch Hand
Posts: 1374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Praveen,

I think your question is more related to Swing and we have one dedicated forum for that. Have a look at https://coderanch.com/forums/f-2/Swing-AWT-SWT-JFace It's very likely that you get more responses there than here. This forum is for Spring, WebWork, Tapestry, etc frameworks.
 
Praveen Sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vishal,
I misread Spring as Swing. . Looks like I was in a hurry to post the thread. Ulf has already answered to me. I request the owner to please delete the thread from here. I am posting this in Swing forum to get more valuable inputs. Thanks Ulf and Vishal.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if these 'modules' are JPanels, perhaps a CardLayout might suit,
where the selected modules are added to a cardlayout panel,
and then displayed by selection (next/previous/show), but only
one module can be shown at a time.

think of a JTabbedPane, each module added as a tab, but there are no tabs
to click and change selection
 
Praveen Sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Micheal for the valuable inputs. I will try that out and come back if I get stuck somewhere. Thanks again.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic