DesktopPaneFX is a JavaFX version of Swing’s JDesktopPane which can be used as a container for individual "child" similar to JInternalFrames.
This project started as a fork of JavaFXMDI authored by Lincoln Minto.
You can get the latest version of DesktopPaneFX directly from Bintray’s JCenter repository or Maven Central.
repositories {
jcenter()
}
dependencies {
implementation 'org.kordamp.desktoppanefx:desktoppanefx-core:0.15.0'
}
<dependencies>
<dependency>
<groupId>org.kordamp.desktoppanefx</groupId>
<artifactId>desktoppanefx-core</artifactId>
<version>0.15.0</version>
</dependency>
</dependencies>
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();
}
}
The following features can be activated by defining a System property with a "true"
value:
Property |
Description |
desktoppanefx.detachable.windows |
|
You must meet the following requirements:
-
JDK11 as a minimum
-
Gradle 6.3
You may use the included gradle wrapper script if you don’t have gradle
installed.
-
Download Gradle from http://gradle.org/downloads
-
Unzip the file into a directory without spaces (recommended).
-
Create a GRADLE_HOME environment variable that points to this directory.
-
Adjust your PATH environment variable to include $GRADLE_HOME/bin (%GRADLE_HOME%\bin on Windows).
-
Test your setup by invoking
gradle --version
.
-
Follow the instructions found at http://sdkman.io/ to install SDKMAN.
-
You need a POSIX environment if running Windows. We recommend using Babun Shell (http://babun.github.io/)
-
Once SDKMAN is installed invoke
sdk install gradle 6.3
. -
Test your setup by invoking
gradle --version
.
Gum is a wrapper script that facilitates invoking gradle tasks anywhere within a Gradle project. It’s smart enough to use the gradle wrapper if available or your global gradle command. This is an optional download.
-
Follow the instructions found at https://github.com/kordamp/gm to install gum
Make a full build issuing gm build
.
Run the sampler JavaFX application by invoking the following command
$ gm :sampler:run
If you are interested in fixing issues and contributing directly to the code base, please contact us!