In this scenario I have multiple DefaultSingleCDockables, each containing a JComboBox, added to the same location so that they are stacked. I pull one of them off and leave the other in place so that I can view both at the same time. Click on the one that was not detached so that it has focus. Now, click on the down arrow of the externalized dockable’s combobox. What I’m seeing is that the JComboBox gains focus, the dropdown is shown, and it immediately loses the focus and the dropdown closes. Several focus exchanges fire after the combobox popup is shown. See below SCCE that demonstrates this behavior. I ran into this in Java 6 and 7, DockingFrames Preview Version 1.1.2 17b.
import bibliothek.gui.dock.StackDockStation;
import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.CLocation;
import bibliothek.gui.dock.common.DefaultSingleCDockable;
import bibliothek.gui.dock.common.group.TopMostGroupBehavior;
import bibliothek.gui.dock.common.grouping.PlaceholderGrouping;
import bibliothek.gui.dock.common.perspective.CGridPerspective;
import bibliothek.gui.dock.common.perspective.CPerspective;
import bibliothek.gui.dock.station.stack.tab.layouting.TabPlacement;
import bibliothek.util.Path;
import java.awt.BorderLayout;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
public class Test
extends JFrame
{
public Test()
{
super();
CControl control = new CControl(this);
add(control.getContentArea(), BorderLayout.CENTER);
control.setGroupBehavior(new TopMostGroupBehavior());
control.putProperty(StackDockStation.TAB_PLACEMENT,
TabPlacement.TOP_OF_DOCKABLE);
CPerspective layout =
control.getPerspectives().createEmptyPerspective();
CGridPerspective center = layout.getContentArea().getCenter();
Path path = new Path("custom", "flightlist");
center.gridPlaceholder(0, 0, 1, 1, path);
control.getPerspectives().setPerspective(layout, true);
PlaceholderGrouping group = new PlaceholderGrouping(control, path);
JPanel comboPanel1 = new JPanel();
comboPanel1.add(new JComboBox(new String[]
{
"OPTION1", "OPTION2"
}));
DefaultSingleCDockable dockable =
new DefaultSingleCDockable("1", null, "1", comboPanel1, null);
CLocation location;
if (control.getCDockableCount() > 0)
{
location =
control.getCDockable(control.getCDockableCount() -
1).getBaseLocation();
}
else
{
location = control.getDefaultLocation();
}
dockable.setCloseable(false);
dockable.setMaximizable(false);
dockable.setMinimizable(false);
dockable.setTitleShown(false);
dockable.setGrouping(group);
dockable.setSingleTabShown(true);
dockable.setLocation(location);
control.addDockable(dockable);
dockable.setVisible(true);
JPanel comboPanel2 = new JPanel();
comboPanel2.add(new JComboBox(new String[]
{
"OPTION1", "OPTION2"
}));
DefaultSingleCDockable dockable2 =
new DefaultSingleCDockable("2", null, "2", comboPanel2, null);
CLocation location2;
if (control.getCDockableCount() > 0)
{
location2 =
control.getCDockable(control.getCDockableCount() -
1).getBaseLocation();
}
else
{
location2 = control.getDefaultLocation();
}
dockable2.setCloseable(false);
dockable2.setMaximizable(false);
dockable2.setMinimizable(false);
dockable2.setTitleShown(false);
dockable2.setGrouping(group);
dockable2.setSingleTabShown(true);
dockable2.setLocation(location2);
control.addDockable(dockable2);
dockable2.setVisible(true);
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
pack();
setVisible(true);
}
});
}
public static void main(String[] args)
{
new Test();
}
}```