无论如何,Java中是否可以设置特定JFrame的分辨率而不是更改计算机的分辨率,这意味着如果我拥有大小为100x100的JFrame,我可以做到这一点,因此左上角将是(0,0),底部是对吗(50,50)?这些点是JFrame内部的坐标,例如,在使用Graphics(java.awt.Graphics)时。
谢谢。
最佳答案
Graphics2D
具有缩放选项,请在Javadoc中进行维护。
就您而言,就是这样:
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.scale(0.5, 0.5); // 50% x and 50% y
// rest of rendering
}