-2

I would like to fold or hide the Swing UI components in IntelliJ IDEA.

I'm working on a Swing Form class, and the components take over 65 lines as it is the main window of the application, and added up to the "Usages" hints take up a lot of space.

Here's a part of the file.

The lines can be identified by the small component symbol on the right of the line number. They are all on the same section (lines 18 to 85 in my case).

Note: the /unused/ hint is the IDEA shorthand for @SuppressWarnings("unused").

loggeek
  • 123
  • 1
  • 9

1 Answers1

1

Found a solution:

  • Select the code block
  • Press Shift twice to bring up the search menu
  • Select the Fold Selection/Remove Region option, or use the Ctrl+. shortcut

On the upside it works with any block, but I have to redo that operation everytime I want to modify the UI, so it's not ideal.

loggeek
  • 123
  • 1
  • 9