Eclipse,创建新 Java 类的快捷方式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19339769/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse, shortcut to create new Java class
提问by giampaolo
Is it possible to assign a shortcut to go automatically on New Java ClassDialog? At the very beginning of a project when I am creating a lot of classes, it's quite annoying have to go through the 'New..' wizard.
是否可以分配快捷方式以自动进入新 Java 类对话框?在一个项目的最开始,当我创建很多类时,必须通过“ New..”向导非常烦人。
Here's the image of the dialog I want to reach.
这是我想要访问的对话框的图像。
回答by phihag
Select Window
-> Preferences
-> General
-> Keys
and search for New (Class)
. Click on Binding
, press the keyboard shortcut you want, and click OK
to configure the shortcut.
选择Window
-> Preferences
-> General
->Keys
并搜索New (Class)
. 单击Binding
,按下您想要的键盘快捷键,然后单击OK
以配置快捷键。
回答by Sameer Surjikar
Press alt+shift+n it will give you a context menu from where you can select new class,package,interface
按 alt+shift+n 它将为您提供一个上下文菜单,您可以从中选择新类、包、接口
回答by Sreedhar GS
Ctrl+n will launch new wizard, there you can select the class/any to create new document.
Ctrl+n 将启动新向导,您可以在那里选择类/任何来创建新文档。
回答by sumeet
There's an icon (C icon) in the header toolbar for creating class! Its available by default Just click it!
标题工具栏中有一个用于创建类的图标(C 图标)!它默认可用只需单击它!
回答by Ajay Raikar
hit alt+shift+N and then click the respective first character for creating the respective file. For example, let's suppose you want to create a new java class:
点击 alt+shift+N,然后单击相应的第一个字符以创建相应的文件。例如,假设您要创建一个新的 java 类:
- Hit alt+shift+N.
- Hit c (stands for creating java class).
- j (it will highlight the java package).
- 按 alt+shift+N。
- 点击 c(代表创建 java 类)。
- j(它将突出显示 java 包)。
like this you can use shortcut keys as well as first character of the word what you want to create.
像这样,您可以使用快捷键以及要创建的单词的第一个字符。
Hope this might help.
希望这可能会有所帮助。
回答by i474232898
You could use Ctrl+3 to open the "Quick Access" Wizard and type in "java class"
您可以使用 Ctrl+3 打开“快速访问”向导并输入“java 类”
回答by Alferd Nobel
回答by Johnny
You can use the New Java Class wizard to create a Java class. It can be invoked in different ways:
您可以使用新建 Java 类向导来创建 Java 类。它可以通过不同的方式调用:
- By clicking on the File menu and selecting New → Class.
- By right clicking in the package explorer and selecting New → Class.
- By clicking on the class drop down button and selecting class.
- 通过单击文件菜单并选择新建 → 类。
- 通过右键单击包资源管理器并选择新建 → 类。
- 通过单击类下拉按钮并选择类。
The shortcuts for basic Eclipse file management actions are different between Macand Windows/Linuxenvironment.
Mac和Windows/Linux环境中基本 Eclipse 文件管理操作的快捷方式是不同的。
Check it out:
一探究竟:
Visit for more Eclipse shortcuts.
访问更多Eclipse 快捷方式。