B4J Library Dockable windows

I haven't been doing much programming for a while, but I have a small project to do in B4j and wanted a dockable interface. I came across this https://github.com/RobertBColton/DockFX which appears to do what I want.

To test it I recreated the example app (java code here : https://github.com/RobertBColton/DockFX/blob/master/src/main/java/org/dockfx/demo/DockFX.java)

The B4j project is attached. The library hasn't been updated for a while, but I think I can use it as is, so I thought I would share it in case anybody else wanted to.

Download the zipped jar file (dockfx-0.1b.zip) from here : https://github.com/RobertBColton/DockFX/releases, unzip it and copy to your additional libraries folder.

For documentation, I'm afraid you'll have to read the java code available on github.

It's LGPL3 licensed, make sure it's appropriate for your project.

Requires JavaObject and Reflection libraries, see the Test app code for explanations.

06 Jan 2017 : Added jDockFXCV - Custom View version see Post7

06 Jan 2017 : Added more methods, including return underlying Node as Pane (if it is one) to load layouts on. Pass Null to the Initialization and a Pane will be created in the Class.

jDockFX


Library: jDockFX

Author: Steve Laming
Version: 0.03

Depends on:
javaobject, jreflection, dockfx-0.1b

Class: DockPane

  • Class Description:
    • The parent on which DockNodes can be Docked[/I]
  • Methods:
    • AsJO As JavaObject
      • Get the underlying object as a JavaObject
    • AsNode As Node
      • Get the underlying object as a Node
    • DesignerCreateView(Base As Pane , Lbl As Label , Props As Map ) As String
      • Called from the designer on creation
    • GetBase As Pane
      • Get the BasePane for this CustomView
    • Initialize(vCallback As Object , vEventName As String ) As String
      • Called from the designer on initialization
    • IsInitialized As Boolean
      • Tests whether the object has been initialized.
    • NodeCount As Int
      • Returns the number of DockNodes attached to this DockPane
    • SetDefaultUserAgentStylesheet As String
      • Initialize the default styles For the dock pane And undocked nodes using the DockFX
        library's internal Default.css stylesheet
        unlike other custom control libraries this allows the user To override them globally
        using the style manager just As they can with internal JavaFX controls
        this must be called after the primary stage Is shown
        https://bugs.openjdk.java.net/browse/JDK-8132900
    • SplitPane As SplitPane
      • Gets the underlying SplitPane for this DockPane

jDockFX


Library: jDockFX

Author: Steve Laming
Version: 0.03

Depends on:
javaobject, jreflection, dockfx-0.1b

Class: DockNode

  • Class Description:
    • DockNode class represents a dockable Node which can be added to a DockPane[/I]
  • Properties:
    • Closable(Value As Boolean) As Boolean
      • Get / Set the closable property for this DockNode
    • Contents(Value As Node) As Node
      • Get / Set (replace) the current Content Node
    • DockTitleBar(Value As Node) As Node
      • Get/Set the titlebar for this Dock, set it to Null to disable docking and undocking
    • Pane As Pane - [Read Only]
      • Returns the underlying Node as a Pane (if it is one Null if not). You can add nodes or load a layout to this.
    • Tag(Value As Object) As Object
      • Get / Set the Tag Object for this DockNode
  • Methods:
    • Dock(Parent As DockPane , Location As String ) As DockNode
      • Dock this node to a parent.
        Parent a DockPane
        Location one of "CENTER", "TOP", "BOTTOM", "LEFT" or "RIGHT"
    • Graphic(FilePath As String , FileName As String ) As DockNode
      • Set a Graphic for this DockNode. Returns this DockNode
    • Initialize(Module As Object , EventName As String , Title As String , Node As Node ) As DockNode
      • Initializes the object.
        Module - for callback
        EventName - for callback
        Title - the title for the DockNode
        Node - the content of this DockNode, Pass Null if you want to load a layout later
        Returns this DockNode
    • IsDocked As Boolean
      • Get the current Docked Status of this DockNode
    • IsInitialized As Boolean
      • Tests whether the object has been initialized.
    • PrefSize(Width As Double , Height As Double ) As DockNode
      • Set the pref size for this DockNode. Returns this DockNode
    • RemoveDockTitleBar(Archive As Boolean ) As DockNode
      • Remove the DockTitleBar (Disables undocking / Docking) and optionally archive it so we can restore it later
    • RestoreDockTitleBar As DockNode
      • Restore an archived DockTitleBar
 

Attachments

  • DockFXTest.zip
    3.9 KB · Views: 557
  • DockFxDemo.png
    DockFxDemo.png
    28.8 KB · Views: 1,062
  • jDockFXCV0.3.zip
    8.1 KB · Views: 597
Last edited:

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
When I move a window I get this error, this is because I use Java 11. How could that problem be solved with Java 11?
Thank you.

at org.dockfx.DockTitleBar.handle(DockTitleBar.java:53)
at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventFilterRecord.handleCapturingEvent(CompositeEventHandler.java:282)
at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchCapturingEvent(CompositeEventHandler.java:98)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchCapturingEvent(EventHandlerManager.java:223)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchCapturingEvent(EventHandlerManager.java:180)
at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchCapturingEvent(CompositeEventDispatcher.java:43)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:52)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3851)
at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1200(Scene.java:3579)
at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1849)
at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2588)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434)
 

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
They told me to place this command, but I do not know where.

"--add-exports = javafx.graphics / com.sun.javafx.scene.input = ALL-UNNAMED"
 

stevel05

Expert
Licensed User
Longtime User
Sorry I haven't got to Java 11 yet, I'm sure someone that has will be able to help.
 

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
java.lang.IllegalAccessError: class org.dockfx.DockEvent (in unnamed module @0x1af651d1) cannot access class com.sun.javafx.scene.input.InputEventUtils (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.scene.input to unnamed module @0x1af651d1
at org.dockfx.DockEvent.<init>(DockEvent.java:289)
at org.dockfx.DockEvent.<init>(DockEvent.java:260)
at org.dockfx.DockTitleBar.handle(DockTitleBar.java:366)
at org.dockfx.DockTitleBar.handle(DockTitleBar.java:1)
at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventFilterRecord.handleCapturingEvent(CompositeEventHandler.java:282)
at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchCapturingEvent(CompositeEventHandler.java:98)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchCapturingEvent(EventHandlerManager.java:223)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchCapturingEvent(EventHandlerManager.java:180)
at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchCapturingEvent(CompositeEventDispatcher.java:43)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:52)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3851)
at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1200(Scene.java:3579)
at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1849)
at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2588)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:390)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:433)
at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
java.lang.IllegalAccessError: class org.dockfx.DockEvent (in unnamed module @0x1af651d1) cannot access class com.sun.javafx.scene.input.InputEventUtils (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.scene.input to unnamed module @0x1af651d1
at org.dockfx.DockEvent.<init>(DockEvent.java:289)
at org.dockfx.DockTitleBar.handle(DockTitleBar.java:404)
at org.dockfx.DockTitleBar.handle(DockTitleBar.java:1)
at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventFilterRecord.handleCapturingEvent(CompositeEventHandler.java:282)
at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchCapturingEvent(CompositeEventHandler.java:98)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchCapturingEvent(EventHandlerManager.java:223)
at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchCapturingEvent(EventHandlerManager.java:180)
at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchCapturingEvent(CompositeEventDispatcher.java:43)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:52)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3851)
at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1200(Scene.java:3579)
at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1849)
at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2588)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:390)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:433)
at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
 

Rubsanpe

Active Member
Licensed User
Hi, I have used the dockfx-0.4 version and with it the errors that appeared in the log have disappeared. Everything works fine.

Rubén
 
Last edited:
Top