Hello,
I am working on a swing application where i want to not be able to close the external window manually by the user.
Example:
the window has to be docked to the top of the page and the user cannot close the windows application that is running. Is this possible using this docking framework ? I know we can modify the behavior of the internal windows but i need to know about the external ones.
I am not certain what exactly you want to do. But in general you can prevent the user from executing certain drag-n-drop actions. Do you mean something like this?
import javax.swing.JFrame;
import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.CLocation;
import bibliothek.gui.dock.common.DefaultSingleCDockable;
public class CLoseTest {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(20, 20, 400, 400);
CControl control = new CControl(frame);
frame.add(control.getContentArea());
DefaultSingleCDockable dockable = createTestDockable();
control.addDockable(dockable);
dockable.setLocation(CLocation.external(50, 50, 300, 200));
dockable.setVisible(true);
frame.setVisible(true);
}
private static DefaultSingleCDockable createTestDockable(){
DefaultSingleCDockable dockable = new DefaultSingleCDockable("id", "Title"){
@Override
public boolean isNormalizeable() {
return false; // usually clients do not do this, hence this property cannot be set easily
}
};
dockable.setMinimizable(false);
return dockable;
}
}
[QUOTE=Beni]I am not certain what exactly you want to do. But in general you can prevent the user from executing certain drag-n-drop actions. Do you mean something like this?
import javax.swing.JFrame;
import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.common.CLocation;
import bibliothek.gui.dock.common.DefaultSingleCDockable;
public class CLoseTest {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(20, 20, 400, 400);
CControl control = new CControl(frame);
frame.add(control.getContentArea());
DefaultSingleCDockable dockable = createTestDockable();
control.addDockable(dockable);
dockable.setLocation(CLocation.external(50, 50, 300, 200));
dockable.setVisible(true);
frame.setVisible(true);
}
private static DefaultSingleCDockable createTestDockable(){
DefaultSingleCDockable dockable = new DefaultSingleCDockable("id", "Title"){
@Override
public boolean isNormalizeable() {
return false; // usually clients do not do this, hence this property cannot be set easily
}
};
dockable.setMinimizable(false);
return dockable;
}
}
```[/QUOTE]
thanks a lot for this informative reply. that does help.
As a followup, is there a way to dock the main window to the top of the screen like a start menu is docked to the bottom of the screen ? I would like it so i dont have to resize the other windows that are running. they get resized just like when we drag the start toolbar to the top of the screen.