diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch) | |
tree | acaf47eb0fa12142d3896416a69e74cbf5a72242 /languages/java/app_templates/superwaba/sw.java | |
download | tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'languages/java/app_templates/superwaba/sw.java')
-rw-r--r-- | languages/java/app_templates/superwaba/sw.java | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/languages/java/app_templates/superwaba/sw.java b/languages/java/app_templates/superwaba/sw.java new file mode 100644 index 00000000..e1c9927c --- /dev/null +++ b/languages/java/app_templates/superwaba/sw.java @@ -0,0 +1,97 @@ + +/** An example that shows the new user interface gadgets for grayscale */ + +import waba.fx.*; +import waba.sys.*; +import waba.ui.*; + +public class %{APPNAME} extends MainWindow +{ + MenuBar mbar; + Button pushB; + +public %{APPNAME}() +{ + super( "%{APPNAME}", TAB_ONLY_BORDER ); + + setDoubleBuffer( true ); + // use native style? + if ( waba.sys.Settings.platform.equals( "PalmOS" ) ) + { + waba.sys.Settings.setPalmOSStyle( true ); + } + // if we are a color device then we can use a nice color + // otherwise WHITE is the most readable + if ( !waba.sys.Settings.isColor ) + { + Color.defaultBackColor = Color.WHITE; + waba.ui.MainWindow.getMainWindow().setBackColor( Color.WHITE ); + } + else + { + Color.defaultBackColor = new Color( 213, 210, 205 ); + waba.ui.MainWindow.getMainWindow().setBackColor( new Color( 213, 210, 205 ) ); + } +} + +public void onStart() +{ + + initGUI(); + Settings.appSecretKey = "installed"; +} + +// Called by the system to pass events to the application. +public void onEvent( Event event ) +{ + if ( event.type == ControlEvent.WINDOW_CLOSED ) + { + if ( event.target == mbar ) + { + switch ( mbar.getSelectedMenuItem() ) + { + case 1: + quitApp(); + break; + case 101: + showAbout(); + break; + default : + break; + } + } + } + else if ( event.type == ControlEvent.PRESSED ) + { + if ( event.target == pushB ) + { + showAbout(); + } + } +} + +private void showAbout( ) +{ + MessageBox mb = new MessageBox( "%{APPNAME}", "This is a small test app." ); + mb.setDoubleBuffer( true ); + popupBlockingModal( mb ); +} + +private void quitApp() +{ + exit( 0 ); +} + + +private void initGUI() +{ + String col0[] = { "File","Exit..."}; + String col1[] = { "Help","About" }; + + pushB = new Button( "Push me" ); + add(pushB, CENTER, CENTER); + setMenuBar( mbar = new MenuBar( new String[][]{ col0, col1 }) ); + +} + +} |