开发者

Debugging incorrect AWT display

I'm trying to modify an existing application using AWT for dialogs, etc. I don't know all the code of the application, so I'm not sure how are the objects stacked.

I tried adding a new JButton to a JPanel with no layout. I set location and size, validated, repainted... and nothing is displayed. Now I'm a bit lost - how do I figure out why this happened? Is there 开发者_运维知识库some way to poke around a live application window and see the AWT objects tree? How do I approach this kind of problems?

Disclaimer: I know next to nothing about AWT.


Logging! Making log calls whenever you're manipulating anything on the AWT stack. Most (all?) AWT objects also have decent toString methods, so it's possible to get and print objects in a component and get meaningful debugging information (i.e. for(Component c : frame.getComponents()) { System.err.println(c.toString()); } ).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜