Can we add panels dynamically?


I have a couple of questions about the docking framework. I am working on a charting framework for a trading system. Traders do open multiple charts for multiple markets. The idea here is to have one container for all the opened charts.

To start with, it is easy to have one chart in the frame that uses the docking framework. However, if we need to have multiple of them enclosed in the same frame, I need a way to dynamically add the charts to this frame on opening them.

Can you please answer the following two questions?

  1. Is it possible to dynamically add new panels to the frame that is using docking framework? We do not want to create several charts at the start up and start showing them when a trader opens it.

  2. Is it possible to drag and drop the already opened charts on the existing frame that is using docking framework, such that the newly dropped chart will be added as another tab. I know that it supports very well as long as the panels are added to the same frame. we would like to drop them from outside the frame.


  1. Yes. To me a chart looks like some document you open, maybe edit, and close again. There is a class “DefaultMultipleCDockable” that is designed for exactly such a case. It is even associated with a factory to store and load its content persistently.

  2. Mostly. The framework will use one specific Window as root Window for most JDialogs it creates, otherwise nothing is tied to this root Window. There could be an issue if you try to exchange the root window during runtime, some JDialogs may not notice. I’ll do some testing during the weekend and release a version that will no longer have this issue.
    Also if the user closes a Window it is the clients responsibility to properly clean up any panels (Dockables) and docking areas (DockStations).

Ok, that was perhaps not a satisfying answer. I’d like to add that the framework should support multiple Windows, and if you find an issue then it is a bug. Anyone in this forum will confirm that the usual lifetime of a confirmed bug is around a week.

The new version 1.1.1p5c has now an example included that allows you to test how the framework behaves if more than one JFrame is around.

  • Download the new version
  • Double click on “bin/docking-frames-demo-tutorial.jar”
  • Navigate through “Basics/Common/Multiple Frames” and hit the “start” button.
  • Then you can add Dockables, move them around, minimize them, make them floating…