Developing Basic GUI for micro manager

I am currently trying to develop a basic GUI for micromanager. At first I tried to use the EMU plugin, but whenever I try to launch EMU with my GUI it crashes. Now I am trying to create a plugin where my GUI can be accessed, yet when trying to learn how to develop plugins from the example code given from micromanager this error constantly appears. Any help would be greatly appreciated.

Jun 09, 2021 2:28:36 PM java.util.prefs.WindowsPreferences <init>
WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0xffffffff80000002. Windows RegCreateKeyEx(...) returned error code 5.
Jun 09, 2021 2:28:36 PM java.util.prefs.WindowsPreferences WindowsRegOpenKey1
WARNING: Trying to recreate Windows registry node Software\JavaSoft\Prefs at root 0xffffffff80000002.
Jun 09, 2021 2:28:36 PM java.util.prefs.WindowsPreferences openKey
WARNING: Could not open windows registry node Software\JavaSoft\Prefs at root 0xffffffff80000002. Windows RegOpenKey(...) returned error code 2.
2021-06-09T14:28:36.829400 tid18760 [IFO,App] Finished waiting for plugins to load
2021-06-09T14:28:43.473807 tid18760 [IFO,App] 
                                    [       ] java.lang.IllegalAccessException: class org.micromanager.internal.utils.GUIUtils cannot access class sun.awt.Win32GraphicsEnvironment (in module java.desktop) because module java.desktop does not export sun.awt to unnamed module @255b53dc in Thread[AWT-EventQueue-0,6,main]
                                    [       ]   at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:385)
                                    [       ]   at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:687)
                                    [       ]   at java.base/java.lang.reflect.Method.invoke(Method.java:559)
                                    [       ]   at org.micromanager.internal.utils.GUIUtils.preventDisplayAdapterChangeExceptions(GUIUtils.java:132)
                                    [       ]   at org.micromanager.internal.MMStudio.loadSystemConfiguration(MMStudio.java:810)
                                    [       ]   at org.micromanager.internal.MMStudio.<init>(MMStudio.java:378)
                                    [       ]   at MMStudioPlugin$1.run(MMStudioPlugin.java:83)
                                    [       ]   at java.desktop/java.awt.event.InvocationEvent.dispatch$$$capture(InvocationEvent.java:316)
                                    [       ]   at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java)
                                    [       ]   at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
                                    [       ]   at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
                                    [       ]   at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
                                    [       ]   at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
                                    [       ]   at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
                                    [       ]   at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
                                    [       ]   at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
                                    [       ]   at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
                                    [       ]   at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
                                    [       ]   at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
                                    [       ]   at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
                                    [       ]   at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Micromanager Plugin Tutorial I am following:
https://micro-manager.org/wiki/Version_2.0_Plugins

The Example Code I am trying to use:
https://github.com/micro-manager/micro-manager/tree/master/plugins/Example

What JDK are you using? If anything other than 8, try JDK8.

It looks like you’re trying to use AWT instead of Swing, and MicroManager seems (I’m a relative noob on the GUI front) to be based around Swing.

If you need regular widgets, Swing’s got them. If you need custom drawing stuff, this SE thread is worth a look. https://stackoverflow.com/questions/9612684/drawing-in-java-using-canvas

Thank you, it seems as if JDK 16 no longer supported that class but JDK 8 does.

Based on some quick searches, it looks like our code should not be using that class (it is an internal class not for outside use), but there are likely multiple issues in the code base like that. We develop using JDK8, and advise everyone else working with MM code to do the same. You may (or may not) encounter issues with newer JDKs.

If you ever want to adapt your plugin to using EMU again and encounter trouble, let me know. I’m interested in seeing possible applications, which we may integrate as default plugins !