Setting JPanel colors has no effect in the toolwindow

Answered
        this.contentFactory = ContentFactory.getInstance();
        this.contentManager = toolWindow.getContentManager();

        JPanel jPanel = new JPanel(new BorderLayout());
        JLabel jLabel = new JLabel("hi, is my chat");
        jLabel.setOpaque(true);
        jLabel.setBackground(Color.RED);
        jPanel.setBackground(Color.RED);
        jPanel.add(jLabel, BorderLayout.CENTER);

        Content content = contentFactory.createContent(jPanel, "", false);
        contentManager.addContent(content);

How to solve the problem of color in the desired effect? Thank you

0
1 comment

Hi,

It is not possible to do by plugins.

Background of all components is overriden in https://github.com/JetBrains/intellij-community/blob/243/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.kt . See InternalDecoratorImpl.Companion#setBackgroundRecursively() calls. This is an internal API, and I don't see any way of disabling this behavior by plugins.

0

Please sign in to leave a comment.