繁体   English   中英

如何从paint方法外部创建一个方法,然后在paint中调用它?

[英]How to make a method from outside of the paint method and then call it in paint?

public class window extends JPanel{
    public void paint(){
        //draw stuff
    }
}

//In another file

public class Hero{
    public void draw(){
        //i want to draw the hero using fillRect or other stuff
    }
}

这是如何完成的(如果可能的话)?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM