I just inherited a project in which your Dockables are being used. Right now, each dock maximizes when its tittle bar is double-clicked, or when the maximize button (the only button the dockables have for default) is clicked.
I want to remove the double-click action, or remove the maximize button (I prefer this last option, but it would be nice to know how to do both things).
In the code, I have a class for each Dockable, like this:
public class VentanaParametros extends DefaultDockable{...}
You can disable action and double click when creating a SplitDockStation:
import javax.swing.JFrame;
import bibliothek.gui.DockController;
import bibliothek.gui.dock.DefaultDockable;
import bibliothek.gui.dock.SplitDockStation;
import bibliothek.gui.dock.station.split.SplitDockProperty;
public class Dock {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
DockController controller = new DockController();
controller.setRootWindow(frame);
// disable creation of maximize action by setting "createFullScreenAction=false"
SplitDockStation station = new SplitDockStation(false);
// disable maximize on double click
station.setExpandOnDoubleclick(false);
controller.add(station);
frame.add(station);
station.drop(new DefaultDockable("A"));
station.drop(new DefaultDockable("B"), SplitDockProperty.EAST );
frame.setBounds(20, 20, 400, 400);
frame.setVisible(true);
}
}
To add the maximize action to some Dockables: create a new “SplitFullScreenAction” and use “DefaultDockable.setActionOffers” or use an ActionGuard (I can tell you more if you really need this feature).
And your client can catch double clicks and handle them by itself by calling “controller.getDoubleClickController().addListener(…)”
I have a method to create the docks into de JFrame framePrincipal. I tried to use your code in here like this:
private void crearPanelesVacios(){
DockController controller = new DockController();
controller.setRootWindow(framePrincipal);
SplitDockStation station = new SplitDockStation();
station.setExpandOnDoubleclick(false);
controller.add(station);
framePrincipal.add(station);
if(ventanas.isEmpty()){
Dockable ventanaMedidas = new VentanaMedidas();
Dockable panelGraficas = new PanelGraficas(new LinkedList(), dcb, this);
Dockable ventanaParamsAvanzados = new PanelParametrosAvanzados(null);
Dockable ventanaParams = new VentanaParametros(null, ventanaParamsAvanzados, this);
Dockable panelNodos = new PanelNodos(m, dcb, framePrincipal, nodesServices, (PanelGraficas)panelGraficas, front, curvesServices);
Dockable panelAreaPrincipal = new AreaVentanasGraficas();
this.pNodos = panelNodos;
this.pGraficas = panelGraficas;
this.pParametros = ventanaParams;
this.areaPrincipal = panelAreaPrincipal;
ventanas.add(panelNodos);
ventanas.add(ventanaParams);
ventanas.add(ventanaParamsAvanzados);
ventanas.add(ventanaMedidas);
ventanas.add(panelGraficas);
ventanas.add(areaPrincipal);
etiquetaLogo.setVisible(false);
reestructurarPanel();
}
}
I guess the problem is that I’m using List ventanas and not the station.drop method. The problem is I need to do it like this. How can I do it then?
Anyway, it seems the code eliminates the double-click expanding, and that’s great, but I would like to know how to erase the button and keep the double-click expanding.
Anyway, it seems the code eliminates the double-click expanding, and that’s great, but I would like to know how to erase the button and keep the double-click expanding.
Try:
station.setExpandOnDoubleclick(true);```
That does work? It should not matter how you put the Dockables on the station(s), internally the same methods are called anyway.
The boolean exists since 1.1.0, but did not yet exist in 1.0.8.
You can either upgrade (I would recommend that), or you can override the method “createFullScreenAction” of SplitDockStation and return “null” instead of an action.