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.
我有一个名为的普通 JApplet 类game.java,还有另一个名为room.java. room.java有一个draw()方法,但它需要使用getWidth()and getHeight()from the ,game.java以便paint()在用户调整窗口大小时它可以在每个上调整自己的大小。我知道我可以创建方法并将其传递给room.java但我想知道是否有另一种方法room.java可以访问 JApplets 的高度和宽度。
game.java
room.java
draw()
getWidth()
getHeight()
paint()