<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><br id="lineBreakAtBeginningOfMessage"><div><br><blockquote type="cite"><div>On Oct 12, 2024, at 9:35 AM, David Kopp <codebangusllc@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div><div>Hello everyone,<br><br>I develop cross platform JavaFX applications. On MacOS one of the annoying things about JavaFX is that it does not provide a way to add About <<app_name>> and Settings… to the application menu bar like the java.awt.Desktop class does in Swing.<br><br>My proposal is to add similar functionality to JavaFX. I propose adding the following to javafx.platform.Application:<br><br></div></div></blockquote><br></div><div><br></div><div><div><br><blockquote type="cite"><div>On Oct 12, 2024, at 9:35 AM, David Kopp <codebangusllc@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div>Hello everyone,<br><br>I develop cross platform JavaFX applications. On MacOS one of the annoying things about JavaFX is that it does not provide a way to add About <<app_name>> and Settings… to the application menu bar like the java.awt.Desktop class does in Swing.<br><br></div></blockquote><br></div><div>It would be convenient. Recently I wanted to check that I was current with Scene Builder, but there was no about item with the version.</div><div><br></div><div>I looked at this some time back. </div><div><br></div><div><a href="https://marc.info/?l=openjdk-openjfx-dev&m=167391490829873&w=2">https://marc.info/?l=openjdk-openjfx-dev&m=167391490829873&w=2</a><br></div><div><br></div><div>I did this, incomplete as a lot of my stuff is, after the following note.</div><div><br></div><div><a href="https://github.com/mik3hall/JavaFXDesktop">https://github.com/mik3hall/JavaFXDesktop</a></div><div><br></div><div><div>On Jan 6, 2023, at 4:35 PM, Michael Hall <mik3hall@gmail.com> wrote:</div><div><br></div><div>I haven’t verified if this would further allow changing the java.awt.Desktop about handler. </div><div><br></div><div>I did check that custom AboutHandlers are possible for OS/X JavaFX applications. </div><div>With…</div><div><br></div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>static {</div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>//java.awt.Toolkit.getDefaultToolkit(); // Start AppKit</div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>Thread t = new Thread(() -> { java.awt.Toolkit.getDefaultToolkit(); });</div><div> <span class="Apple-tab-span" style="white-space: pre;"> </span>t.start(); </div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>}</div><div><br></div><div>I made the Application class itself the handler…</div><div><br></div><div>public class HelloWorld extends Application implements AboutHandler {</div><div><br></div><div>Setting the handler seemed to also need some thread management.</div><div><br></div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>@Override</div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>public void init() {</div><div> <span class="Apple-tab-span" style="white-space: pre;"> </span>Thread t = new Thread(() -> {</div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>Desktop desktop = Desktop.getDesktop();</div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>desktop.setAboutHandler((AboutHandler)this); </div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>});</div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>t.start();<span class="Apple-tab-span" style="white-space: pre;"> </span> <span class="Apple-tab-span" style="white-space: pre;"> </span></div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>}</div><div><br></div><div>It appeared this could be done in the init or about anywhere in the javaFX start method.</div><div><br></div><div>The handler I think comes in on the AWT EventQueue so needs to be changed to javaFX</div><div><br></div><div> public void handleAbout(AboutEvent evt) {</div><div> <span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("got to handleAbout");</div><div> <span class="Apple-tab-span" style="white-space: pre;"> </span>Platform.runLater(() -> {</div><div> <span class="Apple-tab-span" style="white-space: pre;"> </span>Alert alert = new Alert(AlertType.INFORMATION, "About HelloWorld");</div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>alert.showAndWait();</div><div><span class="Apple-tab-span" style="white-space: pre;"> </span>});</div><div> }</div><div><br></div><div>Checking on Windows 10 VirtualBox it appeared Desktop.Action.APP_ABOUT isn’t supported. </div><div>I had trouble with my VirtualBox linux images so didn’t verify there but I’m guessing this is viewed as OS/X only and not supported there either.</div><div><br></div><div>I never really did determine why javaFX applications are different. My last thought had been that they instantiated an NSApplication early so a NSApplicationAWT wss never obtained. However, I later thought I saw where I passed a check indicating I had to have NSApplicationAWT. With a fix so you get the About menu item it seemed a little moot. What I provided for ApplicationDelegate seems to be one such fix. You can come up with your own fix but I think it will need to done jdk side though to provide this functionality to javafx app’s. I might bring this up on the javafx list if the jdk does make it possible at some point.</div><div><br></div><div>I haven’t looked at any other Desktop functionality for javafx app’s yet having no immediate need myself. </div></div></div><br></body></html>