diff --git a/src/main/java/eu/jonahbauer/raytracing/render/canvas/LiveCanvas.java b/src/main/java/eu/jonahbauer/raytracing/render/canvas/LiveCanvas.java index 402aebd..bfc5fc0 100644 --- a/src/main/java/eu/jonahbauer/raytracing/render/canvas/LiveCanvas.java +++ b/src/main/java/eu/jonahbauer/raytracing/render/canvas/LiveCanvas.java @@ -42,15 +42,19 @@ public final class LiveCanvas implements Canvas { public @NotNull Thread preview() { var frame = new JFrame(); - frame.setSize(getWidth(), getHeight()); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setContentPane(new JPanel() { + { + setPreferredSize(new Dimension(image.getWidth(), image.getHeight())); + } + @Override protected void paintComponent(Graphics g) { g.drawImage(image, 0, 0, null); } }); frame.setResizable(false); + frame.pack(); frame.setVisible(true); var update = Thread.ofVirtual().start(() -> {