我很想知道是否有一种方法来缩放具有JFrame大小的图形对象。因此,如果我使我的JFrame全屏,所有图形将根据我为它们设置的大小进行缩放。感谢
答案 0 :(得分:0)
这是你要找的吗?
public void paint (Graphics g) { //could also be paintComponent(Graphics g)
Dimension initS = initialScale;
Dimension currS = getSize();
Graphics2D g2 = (Graphics2D) g;
g2.scale(((Double)currS.width)/initS.width, ((Double)currS.Height)/initS.height);
//do your painting
}