### JavaFX Example Using DesktopPaneFX Source: https://github.com/kordamp/desktoppanefx/blob/master/README.adoc Demonstrates how to create a DesktopPane and add InternalWindows to it. This example requires JavaFX and DesktopPaneFX libraries. ```java package com.acme; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; import org.kordamp.desktoppanefx.scene.layout.DesktopPane; import org.kordamp.desktoppanefx.scene.layout.InternalWindow; import org.kordamp.ikonli.javafx.FontIcon; public class Example extends Application { private static int count = 0; @Override public void start(Stage stage) throws Exception { DesktopPane desktopPane = new DesktopPane(); Button newWindow = new Button("New Window"); newWindow.setOnAction(e -> { InternalWindow window = new InternalWindow( "window-" + count, new FontIcon("mdi-application:20"), "Title " + count++, new Label("Content")); desktopPane.addInternalWindow(window); }); BorderPane mainPane = new BorderPane(); mainPane.setPrefSize(800, 600); mainPane.setTop(newWindow); mainPane.setCenter(desktopPane); stage.setScene(new Scene(mainPane)); stage.show(); } } ``` -------------------------------- ### Construct and Manage InternalWindow Source: https://context7.com/kordamp/desktoppanefx/llms.txt Demonstrates basic construction of InternalWindow with different configurations (resizable, maximized) and adding them to a DesktopPane. Includes examples of state queries and programmatic window operations. ```java import javafx.scene.control.TextArea; import javafx.scene.layout.VBox; import org.kordamp.desktoppanefx.scene.layout.DesktopPane; import org.kordamp.desktoppanefx.scene.layout.InternalWindow; import org.kordamp.ikonli.javafx.FontIcon; // --- Basic construction --- InternalWindow basicWindow = new InternalWindow( "editor-1", // unique ID new FontIcon("mdi-file-document:20"),// title bar icon "Text Editor", // title new TextArea("Edit here...")); // content node // --- Non-resizable window --- InternalWindow fixedWindow = new InternalWindow( "fixed-1", new FontIcon("mdi-lock:20"), "Fixed Size", new VBox(new javafx.scene.control.Label("Cannot resize")), false); // resizable = false // --- Starts maximized --- InternalWindow maxWindow = new InternalWindow( "max-1", new FontIcon("mdi-fullscreen:20"), "Full View", new TextArea("Maximized content"), true, // resizable true); // start maximized DesktopPane pane = new DesktopPane(); pane.addInternalWindow(basicWindow); pane.addInternalWindow(fixedWindow); pane.addInternalWindow(maxWindow); // --- State queries --- System.out.println(basicWindow.isActive()); // true when focused System.out.println(basicWindow.isMinimized()); // false System.out.println(basicWindow.isMaximized()); // false System.out.println(basicWindow.isDetached()); // false (not floating as OS window) // --- Replace content at runtime --- basicWindow.setContent(new TextArea("New content")); // --- Programmatic window operations --- basicWindow.minimizeWindow(); basicWindow.maximizeOrRestoreWindow(); basicWindow.closeWindow(); ``` -------------------------------- ### Run DesktopPaneFX Sampler with Gradle Wrapper Source: https://github.com/kordamp/desktoppanefx/blob/master/README.adoc Execute the sampler application using the provided Gradle wrapper script. Ensure Gradle is installed or use the wrapper. ```bash $ gm :sampler:run ``` -------------------------------- ### Position and Snap InternalWindow Source: https://context7.com/kordamp/desktoppanefx/llms.txt Illustrates how to position and snap InternalWindow instances within a DesktopPane using methods like snapTo(), place(), and center(). Includes examples of using AlignPosition enums and handling potential exceptions. ```java import javafx.geometry.Point2D; import org.kordamp.desktoppanefx.scene.layout.DesktopPane; import org.kordamp.desktoppanefx.scene.layout.InternalWindow; import org.kordamp.ikonli.javafx.FontIcon; import javafx.scene.control.Label; DesktopPane desktopPane = new DesktopPane(); InternalWindow win = new InternalWindow( "snap-demo", new FontIcon("mdi-move:20"), "Snap Demo", new Label("Snap me!")); desktopPane.addInternalWindow(win); // Snap to named positions win.snapTo(InternalWindow.AlignPosition.CENTER); // center of pane win.snapTo(InternalWindow.AlignPosition.TOP_LEFT); // (0, 0) win.snapTo(InternalWindow.AlignPosition.TOP_RIGHT); // top-right corner win.snapTo(InternalWindow.AlignPosition.BOTTOM_LEFT); // bottom-left corner win.snapTo(InternalWindow.AlignPosition.BOTTOM_RIGHT); // bottom-right corner win.snapTo(InternalWindow.AlignPosition.CENTER_LEFT); // vertically centered, left edge win.snapTo(InternalWindow.AlignPosition.CENTER_RIGHT); // vertically centered, right edge win.snapTo(InternalWindow.AlignPosition.TOP_CENTER); // horizontally centered, top edge win.snapTo(InternalWindow.AlignPosition.BOTTOM_CENTER); // horizontally centered, bottom edge // Place at exact pixel coordinates (throws PositionOutOfBoundsException if out of bounds) try { win.place(new Point2D(150, 80)); } catch (org.kordamp.desktoppanefx.scene.layout.PositionOutOfBoundsException ex) { System.err.println("Position out of bounds: " + ex.getMessage()); } // Center convenience method win.center(); // DesktopPane-level equivalents (operate directly on the container) desktopPane.centerInternalWindow(win); desktopPane.placeInternalWindow(win, new Point2D(200, 100)); desktopPane.snapTo(win, InternalWindow.AlignPosition.TOP_CENTER); ``` -------------------------------- ### Create and Manage Internal Windows with DesktopPaneFX Source: https://context7.com/kordamp/desktoppanefx/llms.txt Demonstrates how to create a `DesktopPane` and add `InternalWindow` instances to it. Includes listening for active window changes and finding specific windows by ID. Use this to build MDI applications in JavaFX. ```java import javafx.application.Application; import javafx.geometry.Point2D; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; import org.kordamp.desktoppanefx.scene.layout.DesktopPane; import org.kordamp.desktoppanefx.scene.layout.InternalWindow; import org.kordamp.ikonli.javafx.FontIcon; public class MDIApp extends Application { private int count = 0; @Override public void start(Stage stage) { DesktopPane desktopPane = new DesktopPane(); // Listen to active-window changes desktopPane.activeWindowProperty().addListener((obs, oldWin, newWin) -> { if (newWin != null) { System.out.println("Active window: " + newWin.getId()); } }); Button btn = new Button("New Window"); btn.setOnAction(e -> { InternalWindow win = new InternalWindow( "win-" + count, new FontIcon("mdi-application:20"), "Window " + count++, new Label("Hello from window " + count)); desktopPane.addInternalWindow(win); // auto-centers on first display }); // Add a window at an explicit position InternalWindow pinned = new InternalWindow( "pinned-win", new FontIcon("mdi-pin:20"), "Pinned", new Label("Fixed position")); desktopPane.addInternalWindow(pinned, new Point2D(20, 20)); BorderPane root = new BorderPane(); root.setPrefSize(900, 650); root.setTop(btn); root.setCenter(desktopPane); stage.setScene(new Scene(root)); stage.show(); // Query all open windows System.out.println("Windows: " + desktopPane.getInternalWindows().size()); // Find a specific window by ID desktopPane.findInternalWindow("pinned-win") .ifPresent(w -> System.out.println("Found: " + w.getId())); } } ``` -------------------------------- ### TaskBar Configuration and Interaction Source: https://context7.com/kordamp/desktoppanefx/llms.txt Demonstrates how to configure the TaskBar's position, visibility, and interact with TaskBarIcons for minimized windows. ```APIDOC ## TaskBar Configuration ### Description Provides methods to manage the TaskBar, including setting its position and controlling its visibility. ### Methods - `setPosition(TaskBar.Position position)`: Sets the position of the task bar to either `TOP` or `BOTTOM`. - `visibleProperty().set(boolean value)`: Directly sets the visibility of the task bar. ### TaskBarIcon Interaction ### Description Allows querying and interacting with individual icons representing minimized windows on the task bar. ### Methods - `findTaskBarIcon(String id)`: Returns an `Optional` for the specified window ID. - `TaskBarIcon.restoreWindow()`: Restores the associated minimized window. - `TaskBarIcon.closeWindow()`: Closes the associated minimized window. - `getTaskBarIcons()`: Returns a collection of all `TaskBarIcon` objects currently on the task bar. ``` -------------------------------- ### DesktopPane Bulk Window Management Source: https://context7.com/kordamp/desktoppanefx/llms.txt Demonstrates various methods for managing all windows or a subset of windows within a DesktopPane, including minimize, maximize, restore, close, and tiling operations. ```APIDOC ## DesktopPane Bulk Window Management `DesktopPane` provides methods for bulk operations on windows. ### Minimize Operations - `desktopPane.minimizeAllWindows()`: Minimizes all windows. - `desktopPane.minimizeOtherWindows()`: Minimizes all windows except the active one. ### Maximize Operations - `desktopPane.maximizeAllWindows()`: Restores minimized windows and then maximizes all. - `desktopPane.maximizeVisibleWindows()`: Maximizes only non-minimized windows. ### Restore Operations - `desktopPane.restoreMinimizedWindows()`: Restores all windows minimized to the taskbar. - `desktopPane.restoreVisibleWindows()`: Un-maximizes all currently maximized windows. ### Close Operations - `desktopPane.closeAllWindows()`: Closes all windows, firing CLOSE_REQUEST events. - `desktopPane.closeOtherWindows()`: Closes all windows except the active one. ### Tiling Operations - `desktopPane.tileAllWindows()`: Cascades all windows with a default offset. - `desktopPane.tileAllWindows(int width, int height)`: Cascades all windows with a specified size. - `desktopPane.tileVisibleWindows()`: Cascades non-minimized windows. - `desktopPane.tileVisibleWindows(int width, int height)`: Cascades non-minimized windows with a specified size. - `desktopPane.tileHorizontally()`: Stacks windows in equal horizontal bands. - `desktopPane.tileVertically()`: Places windows side-by-side in equal vertical bands. ### Bring to Front - `desktopPane.toFront(String windowId)`: Brings a window to the front by its ID. - `desktopPane.toFront(InternalWindow window)`: Brings a window to the front by its reference. ### Remove Window - `desktopPane.removeInternalWindow(String windowId)`: Removes a window by its ID, firing hidden events. ``` -------------------------------- ### DesktopPane Bulk Window Operations Source: https://context7.com/kordamp/desktoppanefx/llms.txt Use these methods to perform actions on all windows or a subset of windows within a DesktopPane. Ensure DesktopPane and InternalWindow are imported. ```java import org.kordamp.desktoppanefx.scene.layout.DesktopPane; import org.kordamp.desktoppanefx.scene.layout.InternalWindow; import org.kordamp.ikonli.javafx.FontIcon; import javafx.scene.control.Label; DesktopPane desktopPane = new DesktopPane(); // Populate with several windows for (int i = 1; i <= 5; i++) { InternalWindow w = new InternalWindow( "w-" + i, new FontIcon("mdi-window-maximize:16"), "Window " + i, new Label("Content " + i)); desktopPane.addInternalWindow(w); } // --- Minimize operations --- desktopPane.minimizeAllWindows(); // minimize every window desktopPane.minimizeOtherWindows(); // minimize all except the active one // --- Maximize operations --- desktopPane.maximizeAllWindows(); // restore minimized, then maximize all desktopPane.maximizeVisibleWindows(); // maximize only non-minimized windows // --- Restore operations --- desktopPane.restoreMinimizedWindows(); // restore all minimized windows from taskbar desktopPane.restoreVisibleWindows(); // un-maximize all currently maximized windows // --- Close operations --- desktopPane.closeAllWindows(); // close every window (fires CLOSE_REQUEST events) desktopPane.closeOtherWindows(); // close all except the active one // --- Tiling --- desktopPane.tileAllWindows(); // cascade all windows (40px offset steps) desktopPane.tileAllWindows(300, 250); // cascade with fixed 300×250 px size per window desktopPane.tileVisibleWindows(); // cascade non-minimized windows desktopPane.tileVisibleWindows(320, 200); // cascade with fixed size desktopPane.tileHorizontally(); // stack windows in equal horizontal bands desktopPane.tileVertically(); // place windows side-by-side in equal vertical bands // --- Bring to front --- desktopPane.toFront("w-3"); // by ID desktopPane.toFront(desktopPane.getInternalWindows().get(0)); // by reference // --- Remove a specific window --- desktopPane.removeInternalWindow("w-2"); // by ID (fires hidden events) ``` -------------------------------- ### DesktopPane.resolveInternalWindow Utility Source: https://context7.com/kordamp/desktoppanefx/llms.txt Shows how to use the static resolveInternalWindow method to find the enclosing InternalWindow from any child node. ```APIDOC ## DesktopPane.resolveInternalWindow ### Description A static utility method that traverses the scene graph upwards from a given node to find the nearest enclosing `InternalWindow`. ### Method Signature `public static InternalWindow resolveInternalWindow(Node node)` ### Parameters - **node** (`Node`) - Required - The starting node in the scene graph. ### Returns - `InternalWindow` - The enclosing internal window, or `null` if none is found. ### Usage Example ```java InternalWindow win = DesktopPane.resolveInternalWindow(someNode); if (win != null) { // Perform actions on the found window win.minimizeWindow(); } ``` ``` -------------------------------- ### Maven Dependency for DesktopPaneFX Source: https://context7.com/kordamp/desktoppanefx/llms.txt Includes the DesktopPaneFX core library as a dependency in your Maven project. This configuration should be placed within the section of your pom.xml. ```xml org.kordamp.desktoppanefx desktoppanefx-core 0.15.0 ``` -------------------------------- ### Enable Detachable Windows in DesktopPaneFX Source: https://context7.com/kordamp/desktoppanefx/llms.txt Enables the incubating detachable windows feature by setting a system property. This allows InternalWindows to detach from the DesktopPane and float as OS-level Stages. Listeners are provided for detach/attach lifecycle events. ```java import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.TextArea; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; import org.kordamp.desktoppanefx.scene.layout.DesktopPane; import org.kordamp.desktoppanefx.scene.layout.InternalWindow; import org.kordamp.ikonli.javafx.FontIcon; public class DetachableApp extends Application { @Override public void start(Stage primaryStage) { // Enable incubating detachable windows feature at startup System.setProperty("desktoppanefx.detachable.windows", "true"); DesktopPane desktopPane = new DesktopPane(); InternalWindow win = new InternalWindow( "detach-demo", new FontIcon("mdi-arrow-expand-all:20"), "Detachable Window", new TextArea("I can float as a standalone OS window!")); // Listen for detach/attach lifecycle win.setOnDetaching(e -> System.out.println("Detaching...")); win.setOnDetached(e -> System.out.println("Now a floating OS window. isDetached=" + win.isDetached())); win.setOnAttaching(e -> System.out.println("Re-attaching...")); win.setOnAttached(e -> System.out.println("Re-attached. isDetached=" + win.isDetached())); desktopPane.addInternalWindow(win); // Detach/attach programmatically (same as clicking the button) // win.detachOrAttachWindow(); BorderPane root = new BorderPane(desktopPane); root.setPrefSize(800, 600); primaryStage.setScene(new Scene(root)); primaryStage.show(); } } ``` -------------------------------- ### Gradle Dependency for DesktopPaneFX Source: https://github.com/kordamp/desktoppanefx/blob/master/README.adoc Add this dependency to your Gradle project to include the DesktopPaneFX core library. ```groovy repositories { jcenter() } dependencies { implementation '{project-group}:desktoppanefx-core:{project-version}' } ``` -------------------------------- ### TitleBar Customization Source: https://context7.com/kordamp/desktoppanefx/llms.txt Explains how to customize the appearance and behavior of the TitleBar in InternalWindows, including button visibility, enabled states, and title/icon updates. ```APIDOC ## TitleBar Customization `TitleBar` allows customization of window controls. ### Button Visibility - `titleBar.setMinimizeVisible(boolean visible)`: Sets the visibility of the minimize button. - `titleBar.setMaximizeVisible(boolean visible)`: Sets the visibility of the maximize button. - `titleBar.setCloseVisible(boolean visible)`: Sets the visibility of the close button. - `titleBar.setDetachVisible(boolean visible)`: Sets the visibility of the detach button. ### Button Disabled State - `titleBar.setDisableMinimize(boolean disabled)`: Disables the minimize button without hiding it. - `titleBar.setDisableMaximize(boolean disabled)`: Disables the maximize button without hiding it. - `titleBar.setDisableClose(boolean disabled)`: Disables the close button without hiding it. - `titleBar.setDisableDetach(boolean disabled)`: Disables the detach button without hiding it. ### Dynamic Binding - `titleBar.disableCloseProperty().bind(BooleanProperty property)`: Binds the disabled state of the close button to a property. ### Title and Icon Updates - `titleBar.setTitle(String title)`: Updates the title displayed in the title bar. - `titleBar.setIcon(Node icon)`: Updates the icon displayed in the title bar. ### Event Observation - `titleBar.titleProperty().addListener((obs, oldTitle, newTitle) -> ...)`: Adds a listener to observe changes in the title property. ``` -------------------------------- ### Maven Dependency for DesktopPaneFX Source: https://github.com/kordamp/desktoppanefx/blob/master/README.adoc Include this dependency in your Maven project to use the DesktopPaneFX core library. ```xml {project-group} desktoppanefx-core {project-version} ``` -------------------------------- ### Handling InternalWindow Lifecycle Events Source: https://context7.com/kordamp/desktoppanefx/llms.txt Register event handlers for various InternalWindow lifecycle states. Consume WINDOW_CLOSE_REQUEST to prevent closing. ```java import org.kordamp.desktoppanefx.scene.layout.InternalWindow; import org.kordamp.desktoppanefx.scene.layout.InternalWindowEvent; import org.kordamp.desktoppanefx.scene.layout.DesktopPane; import org.kordamp.ikonli.javafx.FontIcon; import javafx.scene.control.Label; DesktopPane desktopPane = new DesktopPane(); InternalWindow win = new InternalWindow( "event-demo", new FontIcon("mdi-bell:20"), "Event Demo", new Label("Watch events")); // Showing / Shown win.setOnShowing(e -> System.out.println("Window is about to show")); win.setOnShown(e -> System.out.println("Window is now visible")); // Hiding / Hidden win.setOnHiding(e -> System.out.println("Window is about to hide")); win.setOnHidden(e -> System.out.println("Window is now hidden")); // Minimize / Restore win.setOnMinimizing(e -> System.out.println("Minimizing...")); win.setOnMinimized(e -> System.out.println("Minimized to taskbar")); // Maximize / Restore win.setOnMaximizing(e -> System.out.println("Maximizing...")); win.setOnMaximized(e -> System.out.println("Maximized")); win.setOnRestoring(e -> System.out.println("Restoring...")); win.setOnRestored(e -> System.out.println("Restored to normal size")); // Activation win.setOnActivated(e -> System.out.println("Window gained focus")); win.setOnDeactivated(e -> System.out.println("Window lost focus")); // Detach / Attach (incubating feature) win.setOnDetaching(e -> System.out.println("Detaching to OS window...")); win.setOnDetached(e -> System.out.println("Now floating as OS window")); win.setOnAttaching(e -> System.out.println("Re-attaching to DesktopPane...")); win.setOnAttached(e -> System.out.println("Re-attached")); // Intercept close — consume event to prevent closing win.setOnCloseRequest(event -> { boolean unsavedChanges = true; if (unsavedChanges) { System.out.println("Close blocked — unsaved changes!"); event.consume(); // window stays open } }); // Observable properties for binding win.activeProperty().addListener((obs, wasActive, isActive) -> System.out.println("Active changed to: " + isActive)); win.minimizedProperty().addListener((obs, old, val) -> System.out.println("Minimized: " + val)); win.maximizedProperty().addListener((obs, old, val) -> System.out.println("Maximized: " + val)); win.closedProperty().addListener((obs, old, val) -> System.out.println("Closed: " + val)); desktopPane.addInternalWindow(win); ``` -------------------------------- ### Manage TaskBar Position and Visibility Source: https://context7.com/kordamp/desktoppanefx/llms.txt Control the position (TOP/BOTTOM) and visibility of the TaskBar. Visibility can be directly set or bound to a property for dynamic updates. A minimized window automatically adds an icon to the task bar. ```java import org.kordamp.desktoppanefx.scene.layout.DesktopPane; import org.kordamp.desktoppanefx.scene.layout.InternalWindow; import org.kordamp.desktoppanefx.scene.layout.TaskBar; import org.kordamp.desktoppanefx.scene.layout.TaskBarIcon; import org.kordamp.ikonli.javafx.FontIcon; import javafx.scene.control.Label; DesktopPane desktopPane = new DesktopPane(); TaskBar taskBar = desktopPane.getTaskBar(); // --- Position: TOP or BOTTOM --- taskBar.setPosition(TaskBar.Position.TOP); // move taskbar to top taskBar.setPosition(TaskBar.Position.BOTTOM); // move taskbar back to bottom (default) // --- Hide/show the task bar entirely --- taskBar.visibleProperty().set(false); // hide taskbar taskBar.visibleProperty().set(true); // show taskbar // --- Observe taskbar visibility via binding --- javafx.beans.property.BooleanProperty showTaskBar = new javafx.beans.property.SimpleBooleanProperty(true); taskBar.visibleProperty().bind(showTaskBar); // Minimize a window so it appears in the taskbar InternalWindow win = new InternalWindow( "tb-icon-demo", new FontIcon("mdi-application:20"), "My App", new Label("Content")); desktopPane.addInternalWindow(win); win.minimizeWindow(); // TaskBarIcon is now auto-added to the taskbar // --- Query taskbar icons --- taskBar.findTaskBarIcon("tb-icon-demo").ifPresent(icon -> { System.out.println("Found icon for: " + icon.getId()); // Restore the window from taskbar icon icon.restoreWindow(); // Or close it directly from the taskbar // icon.closeWindow(); }); // --- Observe all icons --- taskBar.getTaskBarIcons().forEach(icon -> System.out.println("Taskbar: " + icon.getTitle())); ``` -------------------------------- ### TitleBar Customization Options Source: https://context7.com/kordamp/desktoppanefx/llms.txt Customize the appearance and behavior of window controls in the TitleBar. Ensure DesktopPane, InternalWindow, and TitleBar are imported. ```java import org.kordamp.desktoppanefx.scene.layout.DesktopPane; import org.kordamp.desktoppanefx.scene.layout.InternalWindow; import org.kordamp.desktoppanefx.scene.layout.TitleBar; import org.kordamp.ikonli.javafx.FontIcon; import javafx.scene.control.Label; DesktopPane desktopPane = new DesktopPane(); InternalWindow win = new InternalWindow( "tb-demo", new FontIcon("mdi-settings:20"), "Settings", new Label("Content")); desktopPane.addInternalWindow(win); TitleBar titleBar = win.getTitleBar(); // --- Show/hide individual buttons --- titleBar.setMinimizeVisible(true); // default true titleBar.setMaximizeVisible(true); // default true; auto-hidden when resizable=false titleBar.setCloseVisible(true); // default true titleBar.setDetachVisible(false); // hide the detach button (incubating) // --- Disable buttons without hiding them --- titleBar.setDisableMinimize(false); // enable minimize titleBar.setDisableMaximize(false); // enable maximize titleBar.setDisableClose(true); // prevent user from closing via button titleBar.setDisableDetach(false); // --- Bind disabled state dynamically --- javafx.beans.property.BooleanProperty editMode = new javafx.beans.property.SimpleBooleanProperty(false); titleBar.disableCloseProperty().bind(editMode); // close disabled while editing // --- Update title and icon at runtime --- titleBar.setTitle("Settings — Modified"); titleBar.setIcon(new FontIcon("mdi-settings-outline:20")); // --- Observe title changes --- titleBar.titleProperty().addListener((obs, oldTitle, newTitle) -> System.out.println("Title changed to: " + newTitle)); ``` -------------------------------- ### Resolve InternalWindow from Node in FXML Source: https://context7.com/kordamp/desktoppanefx/llms.txt Use the static `DesktopPane.resolveInternalWindow(Node)` utility to find the parent `InternalWindow` from any child node. This is particularly useful within FXML controllers to interact with the containing window. ```java import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.layout.AnchorPane; import javafx.geometry.Point2D; import org.kordamp.desktoppanefx.scene.layout.DesktopPane; import org.kordamp.desktoppanefx.scene.layout.InternalWindow; import java.net.URL; import java.util.ResourceBundle; public class DocumentController implements Initializable { @FXML private AnchorPane rootPane; // the root node of the FXML content @Override public void initialize(URL url, ResourceBundle rb) { // No direct reference to InternalWindow needed in the FXML file } @FXML private void onMinimize() { InternalWindow win = DesktopPane.resolveInternalWindow(rootPane); if (win != null) win.minimizeWindow(); } @FXML private void onClose() { InternalWindow win = DesktopPane.resolveInternalWindow(rootPane); if (win != null) win.closeWindow(); } @FXML private void onCenterWindow() { InternalWindow win = DesktopPane.resolveInternalWindow(rootPane); if (win != null) win.center(); } @FXML private void onSnapTopRight() { InternalWindow win = DesktopPane.resolveInternalWindow(rootPane); if (win != null) win.snapTo(InternalWindow.AlignPosition.TOP_RIGHT); } } ``` -------------------------------- ### Java Module Declaration for DesktopPaneFX Source: https://context7.com/kordamp/desktoppanefx/llms.txt Declares the necessary module requirements for a JavaFX application using DesktopPaneFX. This ensures the application can access the DesktopPaneFX core library and JavaFX modules. ```java // module-info.java module com.example.myapp { requires org.kordamp.desktoppanefx.core; requires javafx.controls; requires javafx.fxml; } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.