Undecorator – “Add a better look to your JavaFX stages” – Part I


Warning: I strongly encourage you to use the latest Undecorator version named UndecoratorBis.

Each time, when I start a new JavaFX project all begins with the following generated code:

public class UndecoratorStageDemo extends Application {

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

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

Scene scene = new Scene(root);

stage.setScene(scene);

stage.show();
 }

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

And the visual result is obviously the same as in the Scene Builder once launched from Netbeans:

Classic look under Windows 7

Classic look under Windows 7

The window style is inherited from the system. Since I’d like my application to have a consistent look (not mixing Windows frame decoration and JFX content) I immediately activated the “undecorated” flag of the stage and of course I’ve lost all resize, move, maximize… capabilities.
Currently using JavaFX, there’s no out of the box skin for undecorated window, so I started working on a humble implementation as a learning purpose.

UnDecorate this!

Since I’d like to reuse this work for many project, I wrote kind of an helper class to decorate the main stage. Here is the current usage:

Instead of:

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

Scene scene = new Scene(root);

Simply add the Undecorator jar into your classpath and add Undecorator calls into your code, and set it as root of the scene:

        Parent root = FXMLLoader.load(getClass().getResource("ClientArea.fxml"));
        Undecorator undecorator = new Undecorator(stage, root);

       // Default theme
        undecorator.getStylesheets().add("skin/undecorator.css");

        Scene scene = new Scene(undecorator);

In order to add the nice Drop Shadow effect, adjust your Scene and Stage to be TRANSPARENT:

// Transparent scene and stage
 scene.setFill(Color.TRANSPARENT);
 stage.initStyle(StageStyle.TRANSPARENT);

The complete stage initialization looks like:

public class UndecoratorStageDemo extends Application {

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

 Parent root = FXMLLoader.load(getClass().getResource("ClientArea.fxml"));
 Undecorator undecorator = new Undecorator(stage,root);
 undecorator.getStylesheets().add("skin/undecorator.css");
 Scene scene = new Scene(undecorator);

 // Transparent scene and stage
 scene.setFill(Color.TRANSPARENT);
 stage.initStyle(StageStyle.TRANSPARENT);

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

 stage.setTitle("No title bar");
 stage.setScene(scene);

 stage.show();
 }

And? UI make-up!

Simpyl as the undecorator.jar into your classpath and that’s it:

(Un)decoration!

(Un)decoration!

Looks better no 🙂 ?

Recipe

Four “layers”:

  1. A transparent Stage with Drop shadow effect
  2. Your Content
  3. A transparent decoration layer with all actions and menu.
  4.  A frame for resize capabilities,
Layers of the implementation

Layers of the implementation

The main interest in having layers is it allows to create”non rectangular” user interfaces such as the example below (GitHub Windows client mimic):

Ever seen this before ...

Ever seen this before …

Customize it! Play with skin/undecorator.css

Use your imagination !

.undecorator-background {
  -fx-fill: radial-gradient(focus-angle 45deg, focus-distance 20%, center 25% 25%, radius 50%, reflect, #eeeeee88, #55555588 75%, dimgray);
  -fx-arc-width:25;
  -fx-arc-height:25;
}

Result is:

roundedbordersAndRadialGradientTransparent

You also can  provide your own “stagedecoration.fxml” i.e. all buttons of the transparent decoration pane. As an example,  the built-in one is in  /insidefx/undecorator. Simply copy it, reuse the fx:id, and the built-in controller will handle actions on your buttons.

In you main class, invoke the constuctor with a third parameter:

    Undecorator undecorator = new Undecorator(stage, myClientArea, "mystagedecoration.fxml");

From classic to fancy look:

Code

Test it on your machine by clicking on this executable macJar

Access to the code, project and binaries here:github-logo-transparent

Next Enhancements

  • Bugs
  • API
  • Stage “Utility” style,
  • Win7 window behavior on desktop’s edges
  • i18n
  • Themes

Please share your feedbacks, bugs, request for enhancement in the comment section.

Thanks!

  1. #1 by Lakatos Gyula on 04/02/2013 - 15:04

    Why this is not in jfxtras yet? 🙂 Very nice work! When I’ll arrive at home I’ll try it asap. 🙂

    • #2 by arnaud nouard on 04/02/2013 - 18:39

      I still wonder why 🙂 !
      Thanks for your feedback so far…

      • #3 by Lakatos Gyula on 05/02/2013 - 22:43

        Hmm pretty impressive! What I would done differently: drop everything under JFX 2.2, because thats bundled with 7u6, so that’s what the big majority of people use. This way you can get rid of the Initializable interface, and the static controllers and load the fxml in the constructor instead (http://docs.oracle.com/javafx/2/fxml_get_started/custom_control.htm#BABDAAHE).

      • #4 by arnaud nouard on 06/02/2013 - 08:08

        Excellent idea, I didn’t notice this new shortcut of 2.2. Refactoring in progress 🙂
        Thanks.

    • #5 by fllprbt on 20/05/2014 - 07:45

      Hello!
      Thanks for the implementation!.I would like to ask you if there is any way to compute whether the screen is maximized. I am changing stages and if one is maximized getWidth/Height do not give me proper values. Any workaround to evaluate the maxWidth/Height?
      Thanks in advance

      • #6 by fllprbt on 20/05/2014 - 08:00

        Actually it is simpler than I thought in the beginning. Calculation seems ok for full screen by dragged corner,, issues appear with maximize and fullscreen button.

      • #7 by arnaud nouard on 20/05/2014 - 09:58

        Hi,
        Do you have any screen captures for me to understand the issue?
        Thanks a lot.

      • #8 by fllprbt on 20/05/2014 - 10:48

        In the first picture you can see a maximized stage:

        Through it a new stage(mainStage) is created.

        mainStage.setX(oldStage.getX());
        mainStage.setY(oldStage.getY());
        mainStage.setHeight(oldStage.getHeight());
        mainStage.setWidth(oldStage.getWidth());

        The second picture outputs the result.

        Although in neither maximized nor full screened stages the newly created has the exact size and position, in the case of the fullscreened/maximized the new one is a little smaller.

      • #9 by arnaud nouard on 20/05/2014 - 13:24

        Hi,
        I clearly understand now. I have the same problem when invoking a new stage, e.g. a dialog, from my app. I was not able to reproduce the issue with the demo code, but only in my app.
        I still didn’t catch “who” changed the stage’s bounds. The stage width/height property do not fire any event :(.
        I’m still investigating the issue.
        Thanks.

  2. #10 by Daniel Zimmermann on 05/02/2013 - 15:21

    I just read about it on fxexperience.com – I would have needed this earlier during my “JavaFX2 learning session”…
    Whatever: Great job and hopefully it will find a way into jfxtras!?

    If I find soe time, I will definitly will play a bit around with it.
    I still hope, I can convince my company to make use of JavaFX :-p

    • #11 by Lakatos Gyula on 06/02/2013 - 09:11

      I’m also had to think a lot, because it’s not fit into my application on the way I want. (I’m pretty critical.) This is just an idea but: why not extend the Scene class to create an UndecoratedScene. This would open up a lot of possibilities, like using the scene’s stage by default, or override the set/getRoot methods (if this not collapse the underlying drawing API), so the getRoot would return the nodes inside the decoration. (Not the Undecorate class itself, like now.) It would be awesome if we can manage that a ‘new UndecoratedScene(rootnode);’ would be enough to create the undecoration effect. This is just an idea, popped out from my head when I was on the way to work, maybe it works, maybe not. What do you think?

      Also it would be cool that if I set the stage’s resizable property to false, then it would disable the resizeable effect (border). It’s not supported right now.

      Also sorry for my pretty bad english, I rarery write such a long posts. 🙂

      • #12 by Lakatos Gyula on 06/02/2013 - 09:12

        Ohh I replied to the wrong post, sorry! :S

    • #13 by fllprbt on 20/05/2014 - 17:35

      Well I removed the shadow & reduced the padding around the frame. This was the behavior I wanted from the beginning providing me a resizing solution as well. Thanks for the answers and the tool, it may be the start of an open source credit card manager :). It will be great if at any point you will fix the de-maximize.

      oh that’s the current form after the changes, works fine:

      see you around

      • #14 by arnaud nouard on 21/05/2014 - 09:26

        Hi,
        I think I fixed the issue, at least in my own app.
        Could you check with latest binary or source code I pushed to git?
        Thanks.

  3. #15 by http://yahoo.com on 09/02/2013 - 15:04

    • #16 by fllprbt on 21/05/2014 - 11:41

      great thanks

  4. #17 by devov on 14/02/2013 - 10:58

    Pretty cool, almost exactly what I was looking for.

    A few issues on multimonitor systems:
    -Maximize will always maximize it to the primary screen, rather than the current screen.
    -Moving the window between two screens is inconsistent. It drops the mouse drag event at the screen edges (unless you move the mouse fast enough that you don’t trigger a mouse event right on the screen edge).

  5. #19 by devov on 22/02/2013 - 02:07

    I set up something similar using regions in the scene builder.

    https://nooleanbot.wordpress.com/

    • #20 by arnaud nouard on 22/02/2013 - 20:15

      Nice approach Devov and thanks for the reference in your blog.

  6. #21 by NooleanBot on 25/02/2013 - 02:27

    I was trying to set some custom closing code to execute for different stages using:

    stage.setOnCloseRequest(new EventHandler() {
    @Override
    public void handle(WindowEvent evt) {
    System.out.println(“testing the close operation”);
    }
    });

    In order to fire that event you have to use:

    stage.fireEvent(new WindowEvent(stage, WindowEvent.WINDOW_CLOSE_REQUEST));

    rather than stage.close() or stage.hide() for window closing.

    Not sure if that is the real close operation you’re looking for, or if there is a better way to do it.

    It is nice to be able to do when you want to prompt the user to save, or disconnect from resources, or store the window size and location preferences.

    Thanks for all the updates.

    • #22 by arnaud nouard on 25/02/2013 - 07:18

      Excellent. The window listeners was on my TODO list. I’ll try to test and add this ASAP, as well as the fullscreen and stage icons.
      Thanks!

  7. #23 by Aksel on 08/04/2013 - 09:39

    Hi, very nice exmaple. May i ask if undecorator.jar is available in some maven repo or maybe as binary?

    • #24 by arnaud nouard on 08/04/2013 - 17:48

      Hi,
      Thanks for the feedback. You can take a look at the code and the executable jar by clicking on the image links you will find in he post (GitHub).
      Thanks

  8. #25 by munesh meena on 06/05/2013 - 11:39

    its nice and helpful ..

  9. #26 by Damin on 27/06/2013 - 15:10

    Hello
    I have to say that your idea is amazing! I was wondering if your code is completely open source and if I can use it in a commercial application?
    Thanks for a reply!

    • #27 by arnaud nouard on 27/06/2013 - 15:26

      Hi Damin,
      Thanks a lot for your feedback.
      Feel free to use it for any kind of application, commercial or not, and keep me informed if you can :).
      Thanks.

  10. #28 by douglasparedes on 04/07/2013 - 01:04

    I wanna know how to add many scene. I mean , with a button I want to go to another scene and so

    • #29 by arnaud nouard on 04/07/2013 - 23:33

      Hi,
      The problem is that the Scene and the Stage are linked in the Undecorator scenario (i.e. 1:1). The scene becomes a window with decorations and the Stage becomes transparent.
      So, for your needs you probably have to customize the Undecorator class to support multiple Scene by keeping the decoration layer the same for all different Scenes.
      Hope this helps
      Thanks.

  11. #30 by douglasparedes on 06/07/2013 - 02:29

    wow that could be hard to me hehe , could you make a version to do that?

    • #31 by arnaud nouard on 11/07/2013 - 10:00

      If you directly use the Undecorator class, not the UndecoratorScene, you should be able to do what you need.
      Example:

      public class UndecoratorStageDemo extends Application {
       
      @Override
       public void start(final Stage stage) throws Exception {
       
       Parent root = FXMLLoader.load(getClass().getResource("ClientArea.fxml"));
       Undecorator undecorator = new Undecorator(stage,root);
       undecorator.getStylesheets().add("skin/undecorator.css");
       Scene scene = new Scene(undecorator);
       
       // Transparent scene and stage
       scene.setFill(Color.TRANSPARENT);
       stage.initStyle(StageStyle.TRANSPARENT);
       
      // Set minimum size
      stage.setMinWidth(500);
      stage.setMinHeight(400);
       
       stage.setTitle("No title bar");
       stage.setScene(scene);
       
       stage.show();
       }

      In that scenario the Scene is no longer managed by the Undecorator, so you can switch between your different Scene.
      BTW, I still don’t understand why you change your Scene using a Button instead of changing the Root node of the Scene.
      Thanks.

  12. #32 by Joern on 15/07/2013 - 11:46

    Hi Arnaud!

    First of all, thank you a lot for 4-Layer recipe. I was working on my own on a similar solution. And I think, you can remove the shadow layer completely, by using padding (insets) for the “root”-node of the client-layer. This will create a space (padding) between the stage and the scene. To now drop a shadow, simply use CSS for the root-node.

    For example:
    .root {
    -fx-border-style: none;
    -fx-effect: dropshadow(gaussian,rgba(0,0,0,0.5), 30, 0, 0, 15);
    }

    With this approach, your awesome framework could maybe become even more simpler I hope.

    Best regards,
    Jörn

    • #33 by arnaud nouard on 17/07/2013 - 23:02

      Thanks a lot Joern for your feedback and advice.
      As far as I remember, I’ve seen this technique in the Ensemble demo set.
      But for managing the shadow for focused, maximized and fullscreen mode I don’t see how to handle that from a css value compared to programmatic approach.
      If you have further details, I’m still interesting :).
      Thanks so far!

      • #34 by ibo on 19/02/2015 - 18:29

        Thank you for the quick response. Right after I posted my question i did your first suggestion (I guess I read your mind) and totally forgot looking at this post again. I didn’t do lookup though found the achorpane thru containment hierarchy. I’ll make sure to use the lookup.
        I appreciate you for providing 2 solutions. 2. solution seems like more elegant setting it thru fxml. I am content with the current solution and already moved on to do other stuff… Thanks again for your helpful response.

  13. #35 by Mario on 19/01/2014 - 16:20

    Hey insideFX. I’m a great fan of your Undecorator. I made a plugin for resizing stages comfortably and just had the idea to make a fourth button next to minize which could popup my ScreenFX arranger. just look here: http://vmario89.github.io/ScreenFX/. Greetings, Mario

  14. #36 by JC Frane on 19/10/2014 - 08:43

    Hey, is there a way I can add the dependency of your jar to my maven project? How?
    Thank you very much!

  15. #38 by ibo on 10/02/2015 - 01:05

    Great stuff. We are using this on our upcoming commercial app. Space is a big issue in our application and we need to use all the space available. that said, is there any way for me to add my own control, like a combo box, or some pane, on the Title bar, say between titlebar & the window control buttons (Max, min, etc)?

    • #39 by arnaud nouard on 11/02/2015 - 09:53

      Hi,
      Thanks for your feedback.
      Yes of course you can add nodes, two options for that:
      1. The built-in decoration of the stage is an AnchorPane, you can access it thru undecoratorscene.lookup(“decorationRoot”) and add your nodes with Anchor contraints.
      2. Modify the original insidefx/undecorator/stagedecoration.fxml in SceneBuilder, add you nodes, and specify it thru the corresponding constructor: UndecoratorScene(Stage stage, StageStyle stageStyle, Region root, String stageDecorationFxml)

      Hope this helps.

  16. #40 by ibo on 16/03/2015 - 23:52

    Hello again. I see you have a menu for the window controls (minimize, maximize,close, etc) Is there any way I can add my own action on the same menu, like application settings? Any suggestion is appreciated.

    • #41 by arnaud nouard on 17/03/2015 - 13:40

      Hi,
      I would answer the same as my previous answer. Get the AnchorPane and add your own button to it, with the corresponding AnchorPane’s contraints. You could add a button (34×30) with right attachment=132 and top attachment=-3, next to current fullscreen button.
      Thanks.

      • #42 by ibo on 17/03/2015 - 17:11

        I meant the menu as the context menu which pops up when you click on the arrow button on left top corner. I’d like to add my actions to that menu. Hope it is clearer now.

        I got a hold of the button that pops the menu (by looking up “.decoration-button-menu”) But that was a Button object. If it was a MenuButton object I would have add menu item to its children. I think you are showing a context menu object upon clicking on that button. But I couldn’t find a way to get a hold of that ContextMenu object so I could add my actions to it.

        Any suggestions?

        Thanks again

      • #43 by arnaud nouard on 17/03/2015 - 21:33

        Got it.
        I’ve updated the jar (both Undecorator and UndecoratorBis) and made the ContextMenu accessible with root.lookup(“contextMenu”). You could add your MenuItems in this menu.
        Tell me if fits your needs.
        Thx

  17. #44 by mark lueggers on 23/03/2015 - 09:52

    Hi,
    very nice solution to give the application a better L&F.
    But I have a problem with my test application. When I resize the application my “Client Area” is bigger than the “Tansparent Decoration Pane” so the Client Area overlays the “Transparent Decoration Pane”. Does the Undecoretor solution only works when I set minWidth and minHeight?

    Sorry, I can’t add a screenshot maybe I can send you via mail.

    Regards
    Mark

    • #45 by arnaud nouard on 23/03/2015 - 13:37

      Hi,
      The API respects the client area’s contraints, such as preferred, max and min sizes. But you’re right, this is probably a problem of a lack of info in your UI.
      Did you just try to add this, just to test?
      If you have any code for me to test, I’ll check on my side. Send me a private message on Twitter if you can.
      Thanks.

      • #46 by mark lueggers on 23/03/2015 - 19:23

        That’s it,
        when I give the topmost pane , in my case it is border pane, a preferred width an height than it works. Before this 2 fields have the value “USE_COMPUTED_SIZE”.
        Now I set this fields to 10px and than everything looks fine.

        Regards
        Mark

  18. #47 by herudi sahimar on 14/04/2015 - 09:59

  19. #49 by rohit on 23/04/2015 - 10:25

    protected void setFullScreen(boolean value) {
    Stage stage = undecorator.getStage();
    stage.setFullScreen(value);
    }

    Why isn’t the stage occupying the full screen when it is not in maximized mode. How to accomplish that : when clicked on full screen : please bring up the full screen . just like the default stage or jframe full screen( or native OS window full screen : especially on mac).

    • #50 by arnaud nouard on 23/04/2015 - 13:32

      First: Hello,
      Then, I don’t understand your point. What’s the current problem with the built-in fullscreen button? It switches to native fullscreen mode.

      • #51 by rohit on 23/04/2015 - 18:51

        Sorry, I am not sure how to explain it : When I run the UndecoratorSceneDemo class from demoapp in Netbeans IDE : the stage shows up with specified height and width : which occupies only small portion of the screen. That is good. But now when i click on fullscreen button there : it adjusts the scene to stage height and adds restore button accordingly : and it does not take the stage to native full screen mode at all(expecting it to copy full screen). How can i post screenshots as part of comments : so that I can try to comment more clearly.

      • #52 by arnaud nouard on 24/04/2015 - 11:11

        Wow! You’re right!
        I’m running on MacOS 8u40, what about your OS?
        Seems to be a regression on JavaFX8 8u40 (8u20 works fine) on Undecorated window.
        I’ll investigate the issue.
        Thanks.

      • #53 by arnaud nouard on 24/04/2015 - 11:55

        8u45 also has the problem on Mac, no problem on Windows.
        Fullscreen mode seems to no longer works on mac after 8u20: https://javafx-jira.kenai.com/browse/RT-39077
        😦

  20. #54 by rohit on 25/04/2015 - 03:38

    I did not check on windows (last time when I checked it was not working on windows too.). But it works with 8u20. My Mac is osx Mavericks 10.9.5. I have one more issue : when I try to hover over the minimize , maximize, full screen, close button just from below them( i mean coming from client area) : I see just small portion of the area below the button(s) being transparent and showing the other screen/applications/browser contents on it : I know the stage/scene is transparent but why is it only happening here : don’t know why it is not reproducible when I run the downloaded zip src file from your repository and only happens when I include that jar in my project. Sorry that I am not clear in explaining it. But would have explained it clearly if I can attach some screen shots. I tried adding fxml css : no border, no radius , etc… to hover buttons ..but none is working.

  21. #55 by rohit on 26/04/2015 - 09:48

    Please ignore my previous message. I will check on windows machine java 8u20 and see if it works there. Can you please let me know once you fix the fullscreen functionality (when bundled with latest JDK version) . So that I can use the latest JDK version.

  22. #57 by Lalit Rao on 03/06/2015 - 11:06

    I am facing issues using Undecorated.. The screen is getting shrinked and not visible nicely
    i am using java 8

    • #58 by arnaud nouard on 05/06/2015 - 15:11

      Hi,
      Could you detail a little bit more? Which Undecorator version, OS, Java 8 update Y? Screenshot?
      Thanks.

  23. #59 by devzilabs on 17/06/2015 - 14:17

    This is what i have been looking for. Thank you. But I have an issue, everything works perfectly in Java 7 (jdk1.7.0_45), but it breaks in Java 8 (jdk1.8.0_40). By “break” I mean there appear to be a scene behind the shadow. Please refer to the screen shots below.
    Screen shot Java 7 https://app.box.com/s/kd4kalfmr39904mddash94cejt6at1uy
    Screen shot Java 8 https://app.box.com/s/9b44vm45yxcdi1k3xj6p32o4a2kwawng

  24. #60 by John Astralidis on 18/06/2015 - 17:03

    Hello, first of all thx for great code!

    I have two issues:
    1) I tried to add your undecorator in the Netbeans 8.0.2 FXML Sample FXML-LoginDemo. All works fine, but there is a white rectangle around it! Screenshot: http://i62.tinypic.com/2uhve3p.png
    Why is that and how to remove it?

    2) How can I remove the arrow-menu on the up-left corner?

    Also, I’d like to ask. I set my stage undecorated like this
    stage.initStyle(StageStyle.UNDECORATED)
    but when I press login button I get
    java.lang.IllegalStateException: Cannot set style once stage has been set visible

    How can I set it right?

    Could you please help?

  25. #61 by John Astralidis on 18/06/2015 - 17:15

    OK, I got it done without the white rectangle around it using the code you provide in PartII.

    Though I removed stage.initStyle(StageStyle.UNDECORATED), it shows up undecorated and the
    java.lang.IllegalStateException: Cannot set style once stage has been set visible
    still throws up when I try to login.
    Why is that and how to fix it?

    Also, could you please explain the differenses between them:

    1) Parent root = FXMLLoader.load(getClass().getResource(“ClientArea.fxml”));
    Undecorator undecorator = new Undecorator(stage, root);

    // Default theme
    undecorator.getStylesheets().add(“skin/undecorator.css”);
    Scene scene = new Scene(undecorator);

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

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

    stage.setScene(undecoratorScene);

    • #62 by arnaud nouard on 23/06/2015 - 22:22

      Hi,
      Did you try with the UndecoratorBis version?

      The recommended way to wrap your root node in an undecorated window is shown in this example:

      DemoExample

      Hope this helps.
      Thanks.

  26. #63 by devzilabs on 22/06/2015 - 09:53

    Thanks. The update (Undecorator 8) works okay in Java 8. Thanks again. My problem is now fully solved.

  27. #65 by Kai on 29/06/2015 - 12:19

    Hi,
    Thanks for your awesome Undecorator, I am using it on my app. I wonder if there is a way to remove the contextMenu(arrow-menu) on the top-left

    • #66 by arnaud nouard on 29/06/2015 - 13:36

      Hi and thank you for the comment :),
      To remove the context menu, you could retrieve the menu button (the arrow) with a clientarea.lookUp(“#menu”) and then override default action: menu.setOnMousePressed(new EventHandler() {
      @Override
      public void handle(MouseEvent t) {
      //Empty
      }
      });

      Hope it helps.

      • #67 by Kai on 29/06/2015 - 15:33

        Hi,
        Thanks for replying me. I want to remove(hide) the button completely, your method will only disable the action of context menu. how could I hide it so that user won’t see the arrow?
        Thanks

      • #68 by arnaud nouard on 29/06/2015 - 15:50

        In that case once you have the menu (clientarea.lookUp(“#menu”)) hide it, using a menu.setVisible(false).
        Thanks.

  28. #69 by Rodrigo on 27/08/2015 - 23:55

    Thank you so much! Your project is really awesome and has made my app look a lot better! Hopefully when I get more work done on my project I can contribute with something to yours. Again, thanks!

    • #70 by arnaud nouard on 28/08/2015 - 16:02

      Thank you very much for your feedback. Really appreciate your support on this ;-).
      Cheers, from other part of the world.

  29. #71 by Tobi on 18/11/2015 - 23:16

    Hi Arnaud, really cool project, thanks for sharing this! I have a question: I am also trying to remove the contextMenu(arrow-menu) on the top-left and I’m trying your suggestion with lookUp(“#menu”).
    However it always returns null and I don’t know what I’m doing wrong. Could you share the an exact line of code how it should look like?
    Thanks!

    • #72 by arnaud nouard on 19/11/2015 - 08:48

      Hi,
      You’re right, use this instead:

      Node menu = undecoratorScene.lookup("#StageMenu");
      menu.setVisible(false);

      Thank you for the feedback!

  30. #73 by Marc on 02/03/2016 - 17:28

    Hello, great job with your blog! I have used your Undecorator code to customize my app. However, I am concerned about some issues, that appear when running my app in Windows:

    1. App is not minimizable by toggling app icon in the Windows bar.
    2. When pressing ALT+SPACE and displaying window context menu, Minimize option is disabled.

    I have observed the same behavior when running Undecorator.jar.

    Is there any way to fix this? I appreciate very much your help!

    Marc

  31. #74 by hima4rill on 12/04/2016 - 19:30

    Hi Arnaud, Thank you very much for this great work. Please how can i remove maximize, and minimize menu on the decorator Scene

    • #75 by arnaud nouard on 18/04/2016 - 22:23

      Hi and thank you.
      You could try something like this to access the menu.
      And do whatever you want to do with the Menu:
      ContextMenu contextMenu = (Menu) undecoratorScene.lookup("#StageMenu");
      contextMenu.getItems().remove(0);
      contextMenu.getItems().remove(1);

      Hope this helps.

  32. #76 by Shashaank Tulsyan on 30/10/2016 - 02:28

    It would be really nice to have UndecoratorBis in scene builder, and it should be customizable with all features being exposed by getters and setters and property bindings.
    Is it already there?
    Do you need help in doing it?

    https://jaxenter.com/netbeans/making-custom-javafx-controls-available-in-the-scene-builder

  33. #77 by Godfred on 19/12/2016 - 06:53

    Please how can i remove maximize, and minimize menu on the decorator Scene.try using this cods,
    ContextMenu contextMenu = (Menu) scene.lookup(“#StageMenu”);
    contextMenu.getItems().remove(0);
    contextMenu.getItems().remove(1);
    but the the error that popups is (Can not cast javafx control to javafx scene control Menu).
    Please can you help me with it.Thanks

  1. Java desktop links of the week, February 4 | Jonathan Giles
  2. JavaFX links of the week, February 4 // JavaFX News, Demos and Insight // FX Experience
  3. Javafx – How To Make Splash Screen Win 8 on Spring Hibernate ? | Rudy On 007

Leave a reply to Tobi Cancel reply