开发者

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 e开发者_StackOverflowditing this file. Is there any way to overcome this?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜