Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在 Netbeans 中创建我的 java Swing 应用程序。目前有2000多行代码。在一个文件中包含这么多行是否正确。此外,当我编辑这个文件时,IDE 变得很慢。有什么办法可以克服这个吗?
在较大的摇摆项目中,我会像这样对应用程序进行分区:
每个 GUI 元素都有一个类,如 JPanel、JDialog 等。
为每个屏幕使用单独的包,特别是如果您必须实现自定义的 TableModel 或其他复杂的数据结构
不要使用匿名类和内部类,而是实现一个 ActionListener 并在其中检查 ActionEvent.getActionCommand() 。