Exclude Class/Package from InelliJ auto-import feature

I work primarily with JavaFX, and do not plan to use Swing or AWT. However, when I type Button for the first time in a class, and Intellij auto-imports the class, it often imports java.awt.Button, instead of javafx.scene.control.Button.

Is there any way to specify a list of packages/classes to not auto-import in Intellij to prevent this behaviour?

I have searched through IntelliJ docs, but cannot find anything relating to this particular issue.

Any help appreciated.


Look into “Editor” > “Auto Import” > “Exclude from import and completion”.

enter image description here

Leave a Reply

Your email address will not be published. Required fields are marked *