Skip to content

Windows 10 - Issue with getting acrylic working... #7

Description

@regice202

Hello @dukke! I've finally gotten this library working for me, but I'm having an issue still atm... I'm trying to go off of the examples you sent, and it's working for the most part. I can get dark theme to work just fine. Acrylic on Windows 10, I haven't gotten quite working just yet.. I'm posting my code and some photos down below to help illustrate the issue I'm having. Thanks for your time and help!

stage.addEventHandler(WindowEvent.ANY, new EventHandler<WindowEvent>(){
            @Override
            public void handle(WindowEvent e){
                String type = e.getEventType().getName();

                System.out.println("Window event: " + type);
                switch(type){
                    case "WINDOW_SHOWING": case "WINDOW_SHOWN":
                        if (type.equals("WINDOW_SHOWING")) themeManager = ThemeWindowManagerFactory.create();

                        switch(themeManager.getClass().getSimpleName().replaceFirst(ThemeWindowManager.class.getSimpleName(), "")){
                            case "Mac":
                                MacThemeWindowManager mac = (MacThemeWindowManager) themeManager;
                                break;
                            case "Win10":
                                Win10ThemeWindowManager win10 = (Win10ThemeWindowManager) themeManager;

//                                System.setProperty("prism.forceUploadingPainter", "true");
                                if (type.equals("WINDOW_SHOWING")){
                                    stage.getScene().getRoot().setStyle("-fx-background-color: transparent;");
                                    stage.getScene().setFill(Color.TRANSPARENT);
                                    stage.initStyle(StageStyle.TRANSPARENT);
                                }else{
                                    /*Frost - Alpha|AA| Blue,Green,Red|BBGGRR|*/
                                    int opacity = 0x7D, background = 0xFFFFFF;
//                                    System.out.println("Gradient: " + Integer.toHexString(opacity << 24 | background & 16777215));
                                    win10.enableAcrylic(stage, opacity, background);
//                                    win10.enableAcrylic(stage, 100, 0x990500);
                                }
                                break;
                            case "Win11":
                                Win11ThemeWindowManager win11 = (Win11ThemeWindowManager) themeManager;
                                break;
                            default:
                                themeManager = null;
                                break;
                        }

                        if (themeManager != null){
//                            themeManager.setDarkModeForWindowFrame(stage, true);
                        }
                        break;
                }
            }
        });

It appears for a moment to be working...
java_40mjgReksk

Then.. it just removes the entire window and makes it Undecorated basically..
java_4yMXvb5Uq9

And here you can see Dark Mode working! :D
java_1abjNL3YdU

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions