ModernDocking icon indicating copy to clipboard operation
ModernDocking copied to clipboard

How to remove floating window title bars

Open SingleKey opened this issue 1 year ago • 19 comments
trafficstars

I need to drag the panel out of the original window and use a window style without a title bar for the panel, but I don't know how to set it up. Please give me a suggestion. Thank you.

SingleKey avatar Nov 28 '23 07:11 SingleKey

I'm not sure I follow. The titlebar is always displayed. That's how things are displayed unless you use top tabs.

andrewauclair avatar Nov 28 '23 11:11 andrewauclair

Perhaps they want the jframe title bar to function as the dockable's title bar when it is popped out.

Edit: the close button would have to close only the focused tab unless only one tab is remaining, then close the window.

tlf30 avatar Nov 28 '23 15:11 tlf30

That could be interesting. It would have to revert to individual titlebars if there is more than 1 dockable in the window.

andrewauclair avatar Nov 28 '23 18:11 andrewauclair

I'm not sure I follow. The titlebar is always displayed. That's how things are displayed unless you use top tabs.

I want to drag the panel out of the window, and it will become a floating window~

SingleKey avatar Nov 30 '23 00:11 SingleKey

That could be interesting. It would have to revert to individual titlebars if there is more than 1 dockable in the window.

I want to use jFrame. setUndecorated(true);

SingleKey avatar Nov 30 '23 01:11 SingleKey

That should already be allowed by default. The method responsible is here: https://github.com/andrewauclair/ModernDocking/blob/main/docking-api/src/ModernDocking/Dockable.java#L95.

As long as your Dockable returns true for this method then you should be able to drag and drop outside of the frame to float the Dockable.

andrewauclair avatar Nov 30 '23 01:11 andrewauclair

That could be interesting. It would have to revert to individual titlebars if there is more than 1 dockable in the window.

I think allowing customization would be better~

SingleKey avatar Nov 30 '23 01:11 SingleKey

An example of floating can be seen here: https://github.com/andrewauclair/ModernDocking/blob/main/img/floating_panel.gif

andrewauclair avatar Nov 30 '23 01:11 andrewauclair

An example of floating can be seen here: https://github.com/andrewauclair/ModernDocking/blob/main/img/floating_panel.gif

This example includes the window title bar, which is duplicated with the panel title bar. I don't need the window title bar, but I couldn't find the relevant settings~

SingleKey avatar Nov 30 '23 01:11 SingleKey

Let me see if I understand now. You want the new frame to be undecorated?

andrewauclair avatar Nov 30 '23 01:11 andrewauclair

Let me see if I understand now. You want the new frame to be undecorated?

Yes, because the window title bar is the same as the panel title bar, I would like to use the panel title bar instead of the window title bar, similar to how panels in similar to Visual Studio or IDEA are dragged out of the window.

SingleKey avatar Nov 30 '23 01:11 SingleKey

Let me see if I understand now. You want the new frame to be undecorated?

The solution manager panel and code editor panel of Visual Studio have two different effects when being moved out of the window.

test1

test2

I need the first effect.

SingleKey avatar Nov 30 '23 01:11 SingleKey

Let me see if I understand now. You want the new frame to be undecorated?

I found the relevant code: test

I don't know if this is feasible, but if window transparency is set, kidney damage may occur...

SingleKey avatar Nov 30 '23 02:11 SingleKey

I'll look into adding a setting. This will be more involved than simply calling setUndecorated(true); The resulting frame cannot be resized without additional changes.

andrewauclair avatar Nov 30 '23 18:11 andrewauclair

Not sure if this is what's being requested here, but it would be nice if windows with only one dockable would use the window titlebar instead of the custom panel header. E.g. putting the Inheritance here into the title bar: image

The three-dot menu would have to be hidden, but in this state it contains no useful elements anyway

NebelNidas avatar Nov 30 '23 21:11 NebelNidas

Doing that would mean losing the ability to drag the dockable again as that titlebar is the drag source.

andrewauclair avatar Nov 30 '23 22:11 andrewauclair

Doing that would mean losing the ability to drag the dockable again as that titlebar is the drag source.

Perhaps modifying the window style is not very reasonable. Since the window cannot be modified, can you customize the title bar? I have found the following examples:

https://stackoverflow.com/questions/12822037/how-to-create-customize-title-bar-with-close-button-on-jframe https://copyprogramming.com/howto/how-to-change-the-color-of-the-title-bar-in-javax-swing https://www.codespeedy.com/how-to-change-the-color-of-title-bar-in-jframe-in-java/

SingleKey avatar Dec 01 '23 15:12 SingleKey

Doing that would mean losing the ability to drag the dockable again as that titlebar is the drag source.

Because this feature is different from typical dockable windows, I think it's possible to add a button for docking.

SingleKey avatar Dec 01 '23 15:12 SingleKey

Not sure if this is what's being requested here, but it would be nice if windows with only one dockable would use the window titlebar instead of the custom panel header. E.g. putting the Inheritance here into the title bar: image

The three-dot menu would have to be hidden, but in this state it contains no useful elements anyway

I think in this situation, the title of the panel can be set to the window, including those three points.

SingleKey avatar Dec 01 '23 15:12 SingleKey