The menu bar at the top of your Mac desktop Let's use it in an application created with Processing3.
--Operating environment: processing3.3 --The menu bar at the top of the desktop can only be used after exporting as an app
To create a menu bar, use JMenuBar in Java's Swing.
sample.pde
import java.awt.*;
import javax.swing.*;
JLayeredPane pane = new JLayeredPane();
JMenuBar menubar = new JMenuBar();
void setup() {
System.setProperty("apple.laf.useScreenMenuBar", "true");
Canvas canvas = (Canvas) surface.getNative();
pane = (JLayeredPane) canvas.getParent().getParent();
JMenu menu = new JMenu("menu");
JMenuItem item = new JMenuItem("item");
menu.add(item);
menubar.add(menu);
pane.add(menubar);
}
System.setProperty("apple.laf.useScreenMenuBar", "true");
This will allow you to use the Mac menu bar.
If it looks like this, it's a success.
Use AWT / swing in processing3.
Recommended Posts