How do I create a new class in IntelliJ without using the mouse?

前端 未结 10 1429
隐瞒了意图╮
隐瞒了意图╮ 2021-01-29 18:31

Is there a way to create a new class in a desired location without using the mouse in IntelliJ?

I understand there is no keyboard binding in the default keymap.

相关标签:
10条回答
  • 2021-01-29 19:16

    For Mac Os, command + 1 , then press control + return

    0 讨论(0)
  • 2021-01-29 19:18

    On Mac you can navigate to the location in Project view where you want to create your class and then use ⌘N followed by Enter.

    0 讨论(0)
  • 2021-01-29 19:19

    If you are already in the Project View, press Alt+Insert (New) | Class. Project View can be activated via Alt+1.

    To create a new class in the same directory as the current one use Ctrl+Alt+Insert (New...).

    You can also do it from the Navigation Bar, press Alt+Home, then choose package with arrow keys, then press Alt+Insert.

    Another useful shortcut is View | Select In (Alt+F1), Project (1), then Alt+Insert to create a class near the existing one or use arrow keys to navigate through the packages.

    And yet another way is to just type the class name in the existing code where you want to use it, IDEA will highlight it in red as it doesn't exist yet, then press Alt+Enter for the Intention Actions pop-up, choose Create Class.

    0 讨论(0)
  • 2021-01-29 19:21

    You can also use: ctrl+alt+insert

    0 讨论(0)
提交回复
热议问题