Reference for undecorated window: https://kodejava.org/how-do-i-create-undecorated-frame/
The following source code creates two PApplet windows (undecorated) in addition to the default window.
Addendum: Edited to condense to single class. Developed on Mac; however, should run on all three operating systems.
//https://kodejava.org/how-do-i-create-undecorated-frame/
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;
Window wnd1;
Window wnd2;
class Window extends PApplet {
Frame frame;
Canvas canvas;
Point offset = new Point();
int x, y, w, h;
color bkgrnd;
public Window(int x, int y, int w, int h, color bkgrnd) {
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.bkgrnd = bkgrnd;
PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, this);
frame = ((processing.awt.PSurfaceAWT.SmoothCanvas) surface.getNative()).getFrame();
canvas = (processing.awt.PSurfaceAWT.SmoothCanvas) surface.getNative();
frame.removeNotify();
frame.setUndecorated(true);
frame.addNotify();
frame.setLocation(x, y);
canvas.addMouseListener(new MouseAdapter() {
void mousePressed(MouseEvent msEvnt) {
offset.x = msEvnt.getX();
offset.y = msEvnt.getY();
}
}
);
canvas.addMouseMotionListener(new MouseMotionAdapter() {
void mouseDragged(MouseEvent msEvnt) {
Point pt = frame.getLocation();
frame.setLocation(pt.x + msEvnt.getX() - offset.x, pt.y + msEvnt.getY() - offset.y);
}
}
);
}
void myBtnDisplay() {
fill(255, 226, 13); // button color
strokeWeight(4.0);
stroke(255);
rect( 160, 30, 100, 30, 15); // rounded rect
fill(0); // text color
textSize(20.0);
textAlign(CENTER, CENTER);
text("myBtn", 160, 30-4, 100, 30);
}
void settings() {
size(w, h); // Sets size of canvas
}
void setup() {
background(bkgrnd);
frame.setResizable(true); // To avoid strip at bottom
}
void draw() {
fill(0, 255, 255);
circle(50, 50, 50);
fill(0, 255, 0);
rect(100, 100, 100, 30);
myBtnDisplay();
fill(0, 255, 0);
textSize(20.0);
text("hello", 50, 150, 100, 44);
}
void mousePressed() {
if ((mouseX >= 160) && (mouseX <= 160 + 100) && (mouseY >= 30) && (mouseY <= 30 + 30)) {
println("You hit the button.");
}
}
}
// ========= Default Window ========== //
void setup() {
size(400, 400);
surface.setTitle("Default Window");
wnd1 = new Window(100,100,400,400,color(255,255,0));
wnd2 = new Window(720,100,300,500,color(0,0,255));
}
void draw(){
fill(255, 0, 0);
circle(width/2, height/2, 200);
}