I was using the new feature in the eclipse theme, [Tabs put into menus if there is not enough space] and I open many many tabs. When the menu created contains elements that have a height bigger than the height of the screen, some menu element are not visible and cannot be accessed.
public class Demo03_Theme {
public Demo03_Theme() {
// create a frame
JFrame frame = new JFrame("Demo");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.setSize(600, 500);
DockController controller = new DockController();
controller.setTheme(new EclipseTheme());
controller.getProperties().set(EclipseTheme.PAINT_ICONS_WHEN_DESELECTED, true);
// some stations
StackDockStation station = new StackDockStation();
frame.add(station.getComponent(), BorderLayout.CENTER);
controller.add(station);
for (int i = 0; i < 50; i++) {
JPanel panel = new JPanel();
panel.setOpaque(true);
DefaultDockable dockable = new DefaultDockable(panel, "Dockable " + i);
dockable.setTitleIcon(new ImageIcon(getClass().getClassLoader().getResource("demo/flap_south.png")));
station.drop(dockable);
}
frame.setVisible(true);
}
public static void main(String[] args) {
new Demo03_Theme();
}
Ohm, yeah, that is true. But it looks somewhat artificial, which users opens 50 documents at the same time? I think that is something for the „low-priority-todo-list“
However, we have an application that contains test cases and when a group of testcases opened all the test cases inside it will be displayed. So we are facing this case big time.
Ok. Hm, there is already much flexibility in this part of the framework. It should not be that hard for me to add some kind of menu-interface that would allow to use any kind of component as menu.
I would provide some standard implementation and someone who opens 10000 tabs at once could write its own menu satisfying his special needs (or if I am in the mood I invent something myself).
I’ve realised that there is already such an interface :eek: It is called “CombinedMenuContent”. Usage is simple: write a class that implements CombinedMenuContent, then install an object of that class using the property-key CombinedMenuContent.MENU_CONTENT (see DockController.getProperties().set(…)).
Could you please give me more infos on how to implement the open and cancel methods?
Should I implement a swing component to display the items or I will use something already existing?
There is an implementation called “PopupCombinedMenuContent”, you can use it as reference.
It is up to you how the menu is created and shown. Personally I would show an undecorated JDialog on “open” and close this dialog on “cancel” or on focus-lost. There are no Components present in the framework to display a list of Dockables (other than the already known menus). So you would need to implement your own Component.
How about a JTree where the items are somehow ordered? By name or by function? Or just a JList within a JScrollPane?