1

From the Gui builder in NetBeans 7.4 I can make action methods such as

private void btnFilterActionPerformed(java.awt.event.ActionEvent evt) { }

Is there any way to let NetBeans create protected mathods instead of private ones ?

protected void btnFilterActionPerformed(java.awt.event.ActionEvent evt) { }
Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
lvr123
  • 524
  • 6
  • 24
  • I'm curious as to why you'd want your code to do this. – Hovercraft Full Of Eels Jun 18 '14 at 19:41
  • 1
    If you dig around the preferences you should be able to adjust this, but is agree with HovercraftFullOfEels, why would you want this? If you want to re-use the code, place that code in a suitable method that the event handler can call – MadProgrammer Jun 18 '14 at 20:46
  • @HovercraftFullOfEels:I have sub-classed this class and I want to trigger a different action on that button-click. Another solution would be to keep the generated method private and let it call a new intermediary method that I will override in the subclass, but I found this less readable. – lvr123 Jun 19 '14 at 08:13
  • @MadProgrammer : I already dug far... :/ – lvr123 Jun 19 '14 at 08:15
  • 1
    Hmmm, seems I must have been thinking about the variable modifiers. I would, instead, create `protected` methods that you can call from your event handlers instead... – MadProgrammer Jun 19 '14 at 09:20
  • @MadProgrammer : that's what I've done in the meantime. – lvr123 Jun 19 '14 at 14:29

0 Answers0