Hi @winterchan,
here’s something to tinker with. hope that helps …
Cheers
— mnse
import processing.awt.*;
import javax.swing.*;
import java.awt.*;
import java.awt.Dimension;
import java.awt.GraphicsEnvironment;
import java.awt.GraphicsDevice;
GraphicsDevice device;
JFrame frame;
Dimension prevDimension;
Rectangle bounds;
int mode = 0;
void setup() {
size(500,500);
frame=(JFrame) ((PSurfaceAWT.SmoothCanvas)getSurface().getNative()).getFrame();
prevDimension = ((PSurfaceAWT.SmoothCanvas)getSurface().getNative()).getPreferredSize();
bounds = frame.getBounds();
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
device = ge.getDefaultScreenDevice();
}
void keyReleased() {
if (key == ' ') { // press space
switch(++mode % 2) {
case 0:
frame.setVisible(false);
frame.dispose();
frame.setUndecorated(false);
frame.setBounds(bounds);
surface.setSize((int)prevDimension.getWidth(),(int)prevDimension.getHeight());
device.setFullScreenWindow(null);
frame.setVisible(true);
break;
case 1:
frame.setVisible(false);
frame.dispose();
frame.setUndecorated(true);
surface.setSize(displayWidth,displayHeight);
device.setFullScreenWindow(frame);
frame.setVisible(true);
break;
}
((PSurfaceAWT.SmoothCanvas)getSurface().getNative()).requestFocus();
}
}
void draw() {
background(0);
fill(255,0,255);
noStroke();
ellipse(width/2,height/2,height/2,height/2);
}