【发布时间】:2013-05-28 15:03:54
【问题描述】:
当我尝试使用paint(Graphics g) 代码时出现错误。您能否帮助解决代码,以便有一个带有 3d 矩形的窗口。谢谢!
private static void paint(Graphics g){
g.draw3DRect(10, 10, 50, 50, true);
然后向底部:
public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
paint();
}
});
}
}
【问题讨论】:
-
Paint 应该在 createandshow 里面,还有什么错误?
-
这是错误:线程“AWT-EventQueue-0”中的异常java.lang.Error:未解决的编译问题:main 类型中的方法paint(Graphics) 不适用于参数( )
标签: java swing graphics jpanel paint