开发者

NetBeans - how to move Panel to new file (code too large)

开发者 https://www.devze.com 2023-02-17 21:31 出处:网络
Technologies: NetBeans 6.9.1, SwingX 1.6.2 I have a JFrame with many JXPanels (with many other components on them). initComponents() method is guarded 开发者_C百科by NetBeans (for GUI sync reasons, I

Technologies: NetBeans 6.9.1, SwingX 1.6.2

I have a JFrame with many JXPanels (with many other components on them). initComponents() method is guarded 开发者_C百科by NetBeans (for GUI sync reasons, I guess).

I'd like to move all of JXPanels to new .java files (due to size of initComponents() method - code too large error) and still be able to edit them in visual editor. How can I do that? Is there any possibility to achieve it without 3rd part tools like Notepad (quite unsafe)?

Any other ideas how can I split initComponents() easily and safely to avoid code too large error?


The real answer is to not do this in a visual editor. With a class this big how are you going to debug it? It is definitely worth the learning curve to code Swing by hand, even if it appears to be too large of a task.

I would not look much at the your current code when re-writing it as it will be nasty and written to support the visual editor not a developer. Instead start from scratch one component at a time and build up your GUI. Break it out into smaller classes that have their own responsibilities. It will take some time but once you complete it, it will make future projects much simpler and will provide you valuable knowledge for debugging.

0

精彩评论

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