rgksugan
rgksugan

Reputation: 3582

How to write modular code in netbeans java swing applications?

I am creating my java Swing application in Netbeans. At present there are more than 2000 lines of code. Is it right to have these many number of lines in a single file. Moreover the IDE has become slow when i am editing this file. Is there any way to overcome this?

Upvotes: 2

Views: 976

Answers (1)

stacker
stacker

Reputation: 68972

In larger swing projects I do partinioning of the app like that:

  • Have one class per GUI element like JPanel,JDialog etc.

  • Use a separate package for each screen, especially if you have to implement customized TableModels or other complex data structures

  • Don't use anonymous and inner classes, implement instead an ActionListener and check ActionEvent.getActionCommand() in there.

Upvotes: 2

Related Questions