|
|
|
@ -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(() -> {
|
|
|
|
|