Undecorator (Part II) – The UndecoratorScene class


Back on the Undecorator track… with a light (but not least) enhancement.

After some refactoring, I finally added a new and easier way to integrate the Undecorator feature into your apps.

This time, I’ve provided the helper thru a subclass of “javafx.scene.Scene”. The usage now looks like:


public class UndecoratorSceneDemo extends Application {

@Override
 public void start(final Stage stage) throws Exception {

  // Your UI
  Parent root = FXMLLoader.load(getClass().getResource("ClientArea.fxml"));

  // The Undecorator as a Scene
  UndecoratorScene undecoratorScene = new UndecoratorScene(stage, root);

  // Set minimum size
  stage.setMinWidth(500);
  stage.setMinHeight(400);

  stage.setScene(undecoratorScene);

  stage.show();
 }

public static void main(String[] args) {
  launch(args);
 }
}

So basically, only one line of code :-).

There is also a small API on the UndecoratorScene class for you to provide your decoration FXML or your own CSS.

Code:

Executable jar file is here:macJar   and access to the code, project and binaries is here:github-logo-transparent

What’s coming next?

Since native Windows feature such as dragging a window close to screen edges to maximize/dock it, is not supported by UNDECORATED stages (http://javafx-jira.kenai.com/browse/RT-27571) I’ll try to provide this feature in this API. Unfortunately, it will also bring this functionality on Mac :-).

Have Fun and feel free to comment!

, ,

  1. #1 by Jeroen on 15/01/2016 - 10:58

    a

  1. Java desktop links of the week, February 24 | Jonathan Giles

Leave a comment