Plugin setup title and layout issues in toolWindow



I'm busy developing a custom plugin (with Kotlin) for phpStorm for my students. The development is ongoing, but I'm running into 2 issues that occur on startup and I have searched every corner of the internet (and ChatGPT in the process) without success.

  1. Title doesn't appear
  2. On first load the layout looks broken. Not all properties (like .background, padding, borders) seem to be rendering correctly. Calling repaint() or revalidate() doesn't do anything as well.

In my structure, I extend ToolWindowFactory and my code runs in the createToolWindowContent method like this:

    override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
        //Irrelevant code creating more Panels etc.

        val somePanel = JPanel(VerticalLayout(1))

        //Calling this code here does nothing, and layout looks off. Calling the same line later in code after an event works as expected.
        somePanel.border = CompoundBorder(MatteBorder(1, 0, 0, 0, Gray._110), JBUI.Borders.empty(10, 0))
        somePanel.background = JBColor(Color(235, 236, 240), Color(57, 59, 64))

        //Doesn't matter what I do, I never ever see a title. The header remains without title. Actually adding Actions with buttons to it DOES work!
                     toolWindow.title = "title" //Doesn't work

I have a feeling I'm missing out on something easy but can't see it. Is the createToolWindowContent method too early to expect correct layout rendering and the ability to set the title of the toolWindow?

Hope someone can help because it seems something in the setup/core of my application is wrong.



Hello MaximTimeClockAntwan van der Mooren,

It's unusual that setting the title for the tool window doesn't work as expected. Your code snippet looks correct, and setting the title should indeed work in the createToolWindowContent method. However, if it's not working, you might try setting the title before adding the main panel to the tool window's component. Also, make sure that there are no other conflicting settings or components affecting the title visibility.

The issue with the layout rendering might be related to the timing of when the layout is being applied. It's possible that the layout isn't fully initialized when you're setting properties like background, padding, and borders. One approach you can try is to defer setting these properties until after the initial layout is complete, such as using invokeLater.

Best Regards
maxim healthcare staffing


Hi Jeannette9728miller Thank you for your reply!

I actually tried to remove all other code and just set the title, still no result. And indeed all documentation and help points to the same solution I already implemented.

For the layout issue, I also tried the invokeLater without effect. Which feels weird, because the same code does show correct layout when executed later after an event.

I simply hoped my starting point was somehow wrong, but if it isn't, I'm unsure what steps to take next.


I even created a clean new project and tested it with just this code:

class TempWindowFactory: ToolWindowFactory {
    override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
        toolWindow.title = "Hello"

No title is shown. I changed phpStorm as target to another IDE, no effect as well.


Hi Antwan,

Could you please share the full code (repository or ZIP) so we can easily reproduce it?


Hi Karol Lewandowski 

I uploaded the test project (which also has the title issue) to a temporary repository: antwanvdm/phpstorm-plugin-test (

I'm searching for a way to share the other full project with the layout issue, as it connects with a country restricted API to chat. So it's pretty difficult to test for you.




Please don't share any other project I would have to build. Could you please confirm I can reproduce the issue by running the plugin from If not, please simplify it to not have any dependency. It should be in a state that allows me to run it and reproduce the issue without any additional activity or setup.



I'm a little confused (first plugin I'm building) on your question. But this repository contains the code and you can reproduce the issues. You should be able to clone the project and run it immediately without any additional setup.

I pushed a new update with the layout issue as well, so both problems (title not showing, and initial layout) can be reproduced with this code. You can test the difference when adding text in the input field and pressing enter. Now you get the same element with background colour. (in this example, only background colour is not working)

Please let me know if I misunderstood anything!


Hi Antwan,

I thought that the second project was required to run the first, but it's not the case.

Regarding the title, please add tool window content via content manager (tool window title is taken from ID):

override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) {
    val mainPanel = JPanel()
    mainPanel.layout = BorderLayout()

    val topText = JTextPane()
    topText.text = "My top layer"
    mainPanel.add(topText, BorderLayout.NORTH)

    chatMessagesPanel.add(chatMessagePanel("Hi! This is mij first message"))
    chatMessagesPanel.add(chatMessagePanel("Another message"))
    chatMessagesPanel.add(chatMessagePanel("Another one"))

    mainPanel.add(chatMessagesScrollPanel, BorderLayout.CENTER)
    mainPanel.add(inputPanel(), BorderLayout.SOUTH)

    val content = ContentFactory.getInstance().createContent(mainPanel, "", false)

I suggest checking the tool window code sample for inspiration:

Please also check whether it fixes layout issues.


Hi Karol,

Thank you very much, the title issue is fixed! Finally!

However, the layout issue remains. It still doesn't get the right layout, only the items added after an event get the right layout. Any idea what could be the reason based on my code?


Hi Karol,

Did you find any time to look at the layout issue? Because the application doesn't render as expected, I feel I'm missing something important in the foundation which is blocking me moving forward.

Thanks in advance!


Please sign in to leave a comment.