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!

About these ads

, ,

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: