'How to generate getters and setters in NetBeans 11.0
I am trying to generate getters and setters or constructor or even methods that come from implemented interface, but I do not get anything. I have tried Alt + Enter, but nothing happens. Tried Alt + i, but when I did that I get only three options like: Connection to Database, Database Table and Action and/or Render Method. I feel like I use cutted version, although I got it from the official site of netbeans. What should I do? I got this only because I thought it will have improvements compared to the stable 8.2, but I get this and not all the plugins I got in 8.2. Should I install something else too to it or? I installed the binary version not the source version.
Link to the image when I press Alt + Ins: https://pasteboard.co/IlbSMDv.png Link to the image of the plugins tab(most of them are activated, all php related are activated): https://pasteboard.co/IlbUolB.png
Solution 1:[1]
To get the context menu working for a PHP class in Apache NetBeans 11.0:
Activate all the PHP plugins:
Create a PHP project using the project wizard.
- Create a class for the PHP project using the project wizard.
- Postion the cursor anywhere within the class, and press ALT+INSERT. You will still see the problem you described in the OP: no getter/setter menu options are presented.
Restart NetBeans, and try again. The menu options are now available:
If you just restart NetBeans I think your context menu should be fine.
Solution 2:[2]
Alt+Insert opens the context menu you are looking for.
Note:
Push Alt+Insert where you would put the new code (i.e. on empty line of the code inside the class)
So don't push Alt+Insert when you are on attribute because "getters and setters" won't be shown
Solution 3:[3]
Alt+Insert opens the context menu you are looking for.
Note: Alt+Insert where you would put the new code
(i.e. Alt+Insert on empty line of the code inside the class)
So don't put Alt+Insert when you are on attribute because "getters and setters" won't be shown
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | skomisa |
| Solution 2 | Gherry |
| Solution 3 | Gherry |


