Dark theme | Light theme

May 25, 2010

Griffon Goodness: Getting the Current Running Mode

A Griffon application can run as standalone application, applet or webstart application. We can access the current running mode of our application from the RunMode class. The following sample view shows how we can access the current running mode with RunMode.current:

import java.awt.FlowLayout
import griffon.util.RunMode

application(title:'Sample to show RunMode.current',
) {
    flowLayout alignment: FlowLayout.CENTER, hgap: 0, vgap: 0 
    label "<html>This app is running in <b>${RunMode.current}</b> mode.</html>"

When we run the application with $ griffon run-app we get the following view:

Run with $ griffon run-applet and we get:

And finally if we run our application with $ griffon run-webstart we get: