"Extract Method" Functionality in NetBeans?
By Geertjan-Oracle on May 13, 2012
Why does NetBeans IDE not have "extract method" functionality?
Well, as Ralph from the NetBeans Team points out, it's as simple as using Alt-Shift-M. For example, here's a big chunk of code in the constructor of the Anagram Game (which is one of the samples in NetBeans IDE):
That big chunk of code deserves its own separate method. So, as you can see, I select it all with my mouse and then I press Alt-Shift-M (or Refactor | Introduce Method), which causes the "Introduce Method" dialog to be displayed, as shown below, where I type "postInitializeGUI", as you can see below:
I click OK in the dialog above. And now the constructor contains a new reference to a method...
...which is defined elsewhere in the code:
Hurray, again, for NetBeans IDE!