どのようにこれを中心にするべきかわかりません。私はlocationRelativeTo nullを使用しようとしましたが、gameBoardは左上隅にとどまりました。 しかし、私はそれを中心にする必要があります。JFrameでオブジェクトを中央に配置する方法
public static void main(String[] args) {
JFrame game = new JFrame();
game.setTitle("Game2048");
game.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
game.setSize(420, 700);
game.setResizable(false);
game.add(new Game2048());
// help here >>>> game.setLocation();
game.setVisible(true);
}
オブジェクトをJFrameの中央に配置するか、またはJFrameを画面の中央に配置しますか? – bachph
私が追加したオブジェクトだけです。 –
「[モニタの解像度に関係なく、JFrameを中央に表示する方法を設定する方法」](https://stackoverflow.com/questions/2442599/how-to-set-jframe-to-appear-centered-regardless-モニタ解像度の) –