Reputation: 90
Suppose I have this code in Java in NetBeans
public class Clazz {
public void method1() {
method3(); // here is my cursor
}
public void method2() {
}
}
So I hit Alt+Enter for hint "create method" which creates my method at the end of class.
public class Clazz {
public void method1() {
method3();
}
public void method2() {
}
private void method3() {
throw new UnsupportedOperationException( "Not supported yet." );
}
}
So my question is how to make method creation just under the current method? Just like that:
public class Clazz {
public void method1() {
method3();
}
private void method3() {
throw new UnsupportedOperationException( "Not supported yet." );
}
public void method2() {
}
}
Thank you for your time :)
Upvotes: 4
Views: 102
Reputation: 11182
Unfortunately, this is not possible. An earlier bug report about the placement of code generated by this feature was dismissed:
The method position is not easy to correct and changes would be possibly inconsistent with other generation behaviour -- currently, we insert the method at the end of block of class members with same priority (GeneratorUtilities ClassMemberComparator).
Upvotes: 1