Dragging external disappears

Hello.
I am testing DockingFrames with a small demo program based on the tutorial provided.
I am experiencing an issue I believe is due to developing on a machine with two displays.

When I run my test demo, it comes up with multiple frames in various states (docked, external).

Scenario 1(no issue):
The test demo exists on display 1. I drag a docked from to become externalized from display 1 to display 1, everything is fine.
Scenario 2 (issue experienced):
The test demo exists on display 1. If I drag a docked frame to become externalized from display 1 to display 2, the frame becomes invisible. The frame still exists (if you click and drag where the frame was last dropped, it will be found); it can then be dragged back onto the content pane.
Scenario 3 (no issue):
The test demo exists on display 2. I drag a docked frame to become externalized from display 2 to display 1, everything is fine.
Scenario 4 (no issue):
The test demo exists on display 2. I drag a docked frame to become externalized from display 2 to display 2, everything is fine.

Any assistance would be greatly appreciated. Thanks!

The framework just opens a new undecorated JDialog wherever you drop the Dockable, there is nothing special happening. Unfortunately I do not have a second monitor, so I cannot test anything :-/

Hm, if you have one JFrame on display 1, and open an undecorated JDialog (see “JDialog.setUndecorated”) on display 2 (with the frame as parent), does that work?

I hope this is what you meant:

**[SIZE=2]
[LEFT]import**[/SIZE] java.awt.event.ActionEvent;[/LEFT]
**[SIZE=2][LEFT]import**[/SIZE] java.awt.event.ActionListener;
[/LEFT]
**[SIZE=2][LEFT]import**[/SIZE] javax.swing.JButton;[/LEFT]
**[SIZE=2][LEFT]import**[/SIZE] javax.swing.JDialog;[/LEFT]
**[SIZE=2][LEFT]import**[/SIZE] javax.swing.JFrame;[/LEFT]
**[SIZE=2][LEFT]import**[/SIZE] javax.swing.JLabel;

?[/LEFT]
**[SIZE=2][LEFT]public**[/SIZE] **[SIZE=2]class**[/SIZE] UndecoratedTest {

**[SIZE=2]public**[/SIZE] **[SIZE=2]static**[/SIZE] **[SIZE=2]void**[/SIZE] main(String[] args) {

**[SIZE=2]final**[/SIZE] JFrame frame = **[SIZE=2]new**[/SIZE] JFrame([SIZE=2]"Frame"[/SIZE]);

frame.setDefaultCloseOperation(JFrame.**[SIZE=2]EXIT_ON_CLOSE**[/SIZE]);

JButton button = **[SIZE=2]new**[/SIZE] JButton([SIZE=2]"Press"[/SIZE]);

button.addActionListener(**[SIZE=2]new**[/SIZE] ActionListener(){

[SIZE=2]@Override[/LEFT]
[/SIZE][LEFT]**[SIZE=2]public**[/SIZE] **[SIZE=2]void**[/SIZE] actionPerformed(ActionEvent e) {

JDialog dialog = **[SIZE=2]new**[/SIZE] JDialog(frame, [SIZE=2]"Palette"[/SIZE]);
dialog.setUndecorated(**[SIZE=2]true**[/SIZE]);
JLabel label = **[SIZE=2]new**[/SIZE] JLabel([SIZE=2]"HIIIIIIIIIIIIIIIIIIIII"[/SIZE]);
dialog.add(label);
dialog.setLocation(2000, 0);
dialog.pack();
dialog.setVisible(**[SIZE=2]true**[/SIZE]);

}});

frame.add(button);
frame.pack();
frame.setVisible(**[SIZE=2]true**[/SIZE]);
}
[/LEFT]
}

Doing this pops up the undecorated JDialog on the second screen with text “HIIIIIIIIIIIIIIIIIIIII”, fully visible… of course also unmoveable.
I also ran it without the frame as the parent (just created new JFrame instead) and that had the same result.

I admit of being completely lost…

Out of curiosity, and fishing in the dark: if you run this program, do you have any different results? And what if you remove the lines with the “comment me out” comment?


import javax.swing.JFrame;

import bibliothek.gui.DockController;
import bibliothek.gui.dock.DefaultDockable;
import bibliothek.gui.dock.ScreenDockStation;
import bibliothek.gui.dock.SplitDockStation;
import bibliothek.gui.dock.station.screen.window.DefaultScreenDockWindowFactory;
import bibliothek.gui.dock.station.screen.window.DefaultScreenDockWindowFactory.Kind;

public class ScreenDockTest {
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		DockController controller = new DockController();
		controller.setRootWindow(frame);
		
		DefaultScreenDockWindowFactory factory = new DefaultScreenDockWindowFactory();
		
		// line 1 to test and comment out
		factory.setUndecorated(false);
		
		// line 2 to test and comment out
		factory.setKind(Kind.FRAME);
		
		// setting the modified factory
		controller.getProperties().set(ScreenDockStation.WINDOW_FACTORY, factory);
		
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setBounds(20,20,400,400);
		
		SplitDockStation center = new SplitDockStation();
		controller.add(center);
		frame.add(center);
		
		ScreenDockStation screen = new ScreenDockStation(controller.getRootWindowProvider());
		controller.add(screen);
		
		DefaultDockable dockable = new DefaultDockable("Test, drag me");
		center.drop(dockable);
		
		frame.setVisible(true);
		screen.setShowing(true);
	}
}