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.
我正在尝试将我的 GUI 的修改版本绘制到 Glasspane 上。我的想法是有一个面板来覆盖绘制功能,但是当我尝试类似
glass = frame.getGlasspane(); glass.draw(g);
即使我使用 frame.setGlasspane(new JPanel()); 初始化了 glasspane,我得到一个 Nullpointer 异常。
谢谢你的帮助
请阅读如何使用根窗格以下示例,有关绘画(图形 g)的示例或此处