Created
April 7, 2014 02:48
-
-
Save mmhelloworld/10014175 to your computer and use it in GitHub Desktop.
Java Applets with Frege
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fregeappletsupport; | |
import javax.swing.JApplet; | |
import javax.swing.SwingUtilities; | |
import fregeapplet.HelloApplet; | |
/** | |
* A starter class since Frege cannot extend a Java class | |
* | |
*/ | |
public class AppletSupport extends JApplet { | |
@Override | |
public void init() { | |
try { | |
SwingUtilities.invokeAndWait(new Runnable() { | |
@Override | |
public void run() { | |
// This calls frege function | |
HelloApplet.appletInit(AppletSupport.this).apply(1).result().forced(); | |
} | |
}); | |
} catch (final Exception e) { | |
System.err.println("createGUI didn't complete successfully"); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module fregeapplet.HelloApplet where | |
import Java.Swing | |
data JApplet = native javax.swing.JApplet | |
appletInit :: JApplet -> IO () | |
appletInit applet = do | |
hw <- JLabel.new "Hello World from frege!" | |
applet.add hw | |
return () | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment