Get IntelliJ window size at runtime

I am developing a plugin for which I want to know the IntelliJ window dimensions at runtime so I can adjust component sizes in my toolwindow accordingly. For example, say 60% of current width for a JTextArea. The problem is this is checked during application startup, and so the dimension values returned are always 0. How do I get the window dimensions during startup?

1 comment

You should use proper LayoutManager inside your ToolWindow instead of adjusting coordinates manually. For example java.awt.GridBagLayout supports 'weights' and can solve the problem you've mentioned: you just use row with two components, the first one is JTextArea with weightx .60 and the second one is empty JLabel or some other 'filler' with weightx .40.

0

Please sign in to leave a comment.