Example:
(Based on WabaSoft's
Scribble example)
Java code:
package galasoftLB.pTestWaba;
import waba.ui.*;
import waba.fx.*;
public class TestWaba extends MainWindow
{
int lastX, lastY;
Graphics g;
Button buttonClear;
public TestWaba()
{
g = new Graphics( this );
buttonClear = new Button( "clear" );
buttonClear.setRect( 0, this.height - 15, 40, 15 );
add( buttonClear );
}
public void onEvent( Event evt )
{
if ( evt.type == PenEvent.PEN_DOWN )
{
PenEvent pe = (PenEvent) evt;
lastX = pe.x;
lastY = pe.y;
}
else
{
if ( evt.type == PenEvent.PEN_DRAG )
{
PenEvent pe = (PenEvent) evt;
g.drawLine( lastX, lastY, pe.x, pe.y );
lastX = pe.x;
lastY = pe.y;
}
else
{
if ( evt.type == ControlEvent.PRESSED )
{
if ( evt.target == buttonClear )
{
this.repaint();
}
}
}
}
}
}
Creating PRC and PDB, Process:
1) TestWaba.class is produced in
e:\galasoft\myjava\class\galasoftLB\pTestWaba\
2) exegen.exe and warp.exe are copied from
d:\waba\wabasdk.10\bin\ in
e:\galasoft\myjava\class\
3) exegen and warp are called with:
exegen TestWaba galasoftLB.pTestWaba.TestWaba TestWaba
warp c TestWaba galasoftLB\pTestWaba\*.class
4) TestWaba.prc, TestWaba.lnk, TestWaba.wrp and
TestWaba.pdb are produced in e:\galasoft\myjava\class\
5) TestWaba.lnk and TestWaba.wrp are deleted
(not used on PalmPilot platform).
6) TestWaba.prc and TestWaba.pdb are copied in
the working directory for this project.
7) exegen.exe and warp.exe are deleted from
e:\galasoft\myjava\class\
Batch file:
This batch (createprcpdb.bat) file is called in
e:\galasoft\myjava\
Syntax: createprcpdb projectName
@echo off
cls
rem Customize here -----------------------------------------------------
set JAVADIR=e:\galasoft\myjava
set BASEPACKAGE=galasoftLB
set WABADIR=d:\waba
echo *******************************************************************
echo Batch file by GalaSoft Laurent Bugnion
echo copyright 2000
echo For more info: www.galasoft.ch
echo *******************************************************************
rem Checking environment and parameter ---------------------------------
if %1/==/ goto noarg
if NOT exist %WABADIR%\wabasdk.10\ goto nowaba
if NOT exist %WABADIR%\wabasdk.10\bin\exegen.* goto noexegen
if NOT exist %WABADIR%\wabasdk.10\bin\warp.* goto nowarp
if NOT exist %JAVADIR%\class\galasoftLB\p%1 goto noclass
if NOT exist %JAVADIR%\class\galasoftLB\p%1\%1.class goto noclass
echo *******************************************************************
echo * Converting %JAVADIR%\class\p%1\%1.class
echo * (and the other classes in this package)
echo * in %JAVADIR%\%1\_current\%1.prc
echo * and %JAVADIR%\%1\_current\%1.pdb
rem Checking output directory for PRC and PDB --------------------------
if exist %JAVADIR%\%1\_current goto direxist
echo *
echo * Creating output directory %JAVADIR%\%1\_current
md %JAVADIR%\%1\_current
:direxist
rem Copying execs from Waba directory ----------------------------------
echo *
echo * Copying executables
copy %WABADIR%\wabasdk.10\bin\exegen.exe %JAVADIR%\class
copy %WABADIR%\wabasdk.10\bin\warp.exe %JAVADIR%\class
rem Change directory to the class dir ----------------------------------
cd class
rem Calling exegen and warp, deleting unused output files --------------
echo *
echo * Creating PRC
exegen %1 %BASEPACKAGE%.p%1.%1 %1
del %1.lnk
echo *
echo * Creating PDB
warp c %1 %BASEPACKAGE%\p%1\*.class
del %1.wrp
rem Moving output files in output directory ----------------------------
echo *
echo * Copying PRC and PDB in output directory
if exist %JAVADIR%\%1\_current\%1.prc del %JAVADIR%\%1\_current\%1.prc
if exist %JAVADIR%\%1\_current\%1.pdb del %JAVADIR%\%1\_current\%1.pdb
move %1.prc %JAVADIR%\%1\_current
move %1.pdb %JAVADIR%\%1\_current
rem Deleting exegen and warp from working directory --------------------
echo *
echo * Deleting executables
del exegen.exe
del warp.exe
goto end
rem Different warnings -------------------------------------------------
:nowaba
echo Cannot find the WABA SDK
goto end
:noexegen
echo Cannot find %WABADIR%\wabasdk.10\bin\exegen.exe
goto end
:nowarp
echo Cannot find %WABADIR%\wabasdk.10\bin\warp.exe
goto end
:noclass
echo Cannot find %JAVADIR%\class\galasoftLB\p%1\%1.class
goto end
:noarg
echo Syntax must be:
echo "createprcpdb [projname]"
goto end
:end
cd %JAVADIR%
|