如何使用 Netbean IDE 在 Java 库中搜索类?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4569609/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 07:01:06  来源:igfitidea点击:

How to search a class in Java Library using Netbean IDE?

javanetbeans

提问by zdcobran

I have no idea, but would like to know whether it is possible or not to search in java libraray using netbean IDE. For example, I have heard ArrayList. And I want to find which package ArrayList belongs to. Is there any tool or plugins to search within Java Library for Netbean IDE?

我不知道,但想知道是否可以使用 netbean IDE 在 java 库中进行搜索。例如,我听说过 ArrayList。我想找到 ArrayList 属于哪个包。是否有任何工具或插件可以在 Netbean IDE 的 Java 库中搜索?

回答by Martin Andersson

CTRL+O

CTRL+O

This shortcut triggers an action called interchangeably by the NetBeans documentation for Go to Type...and Go to type/file. The usage of this shortcut resembles the keyboard shortcut SHIFT+CTRL+Tin Eclipse. Both IDE:s will search for a Java type/class as you type in the opened search field and provides a quick way to navigate to different types and classes. Thus in your case, instead of having to write down "ArrayList x;" in your code somewhere and hold down CTRLwhile you click on the variable type with your mouse (or any other "hack" provided in this thread now or in the future) just press CTRL+Oand type in "arraylis" should be enough.

此快捷方式会触发 NetBeans 文档中针对Go to Type...和可互换调用的操作Go to type/file。这个快捷键的使用类似于键盘快捷键SHIFT+ CTRL+T在Eclipse。当您在打开的搜索字段中键入内容时,两个 IDE:s 都会搜索 Java 类型/类,并提供一种快速导航到不同类型和类的方法。因此,在您的情况下,不必写下“ArrayList x;” 在您的代码中的某处按住并按住CTRL鼠标单击变量类型(或现在或将来在此线程中提供的任何其他“hack”),只需按CTRL+O并输入“arraylis”就足够了。

The shortcut may be changed if you go to your Toolsmenu item and then click Options. A window will pop up. Click on Keymapand find the action. Edit the shortcut.

如果您转到“工具”菜单项,然后单击“选项”,则可能会更改快捷方式。会弹出一个窗口。单击Keymap并找到操作。编辑快捷方式。

You can find keyboard shortcut cards for different versions of Netbeans here.

您可以在此处找到不同版本的 Netbeans 的键盘快捷键卡。

回答by Jigar Joshi

Just type ArrayList+ CTRL + SPACENetbeans will suggest which package it belongs

只需输入ArrayList+ CTRL + SPACENetbeans 就会提示它属于哪个包

But If that class isn't in classpath netbeans will suggest to create a new class with name ArrayList

但是如果该类不在类路径中,netbeans 将建议创建一个具有名称的新类 ArrayList

alt text

替代文字

for second of your question
alt text

对于你的第二个问题
替代文字

回答by rgksugan

This might not be the best way to do that.

这可能不是做到这一点的最佳方式。

Just create an object for this class and press Ctrl+ Shift+ I. It will automatically import all the necessary classes. Hence you can check the package in the import statements.

只需为此类创建一个对象并按Ctrl+ Shift+ 即可I。它将自动导入所有必要的类。因此,您可以在导入语句中检查包。

回答by Sachin Doiphode

You can press ctrl and then move mouse over the function and click. You will move to the file where that function defination is provided. So you can easily see return type .. parameter type

您可以按 ctrl,然后将鼠标移到该功能上并单击。您将移至提供该函数定义的文件。所以你可以很容易地看到返回类型..参数类型

To search Library .. In netbean at the top right corner serach box is given. There you can search library like google.

要搜索库.. 在netbean 的右上角给出了搜索框。在那里你可以像谷歌一样搜索图书馆。