The statement
Db.show("The value displayed is ", arg, trunc);
where arg may be a double or a float will truncate the number of decimal places displyed to trunc, where trunc is an integer.
Ending your program
If you open a window, and opening a
dialog box is opening a window, you must close your program with a specific
command. The most convenient way is to make the last line of your program the
statement
Db.endProgram()
This command will
check that you do wish to end your program. The
command
System.out.exit(0)
will end your
program without any check.
Example Program
The Db.show method is illustrated in
the following example program:
/* DbOutputExample
Illustrates output via a dialog box
Michael Thomas Flanagan
27 May 2005
*/
import flanagan.io.*; / imports the Db class
public class DbOutputExample{
public static void main(String[] args){
double xValue = 1.23456789D;
// output a double
Db.show("The value of xValue is ", xValue, 4);
// End program
Db.endProgram();
}
}
The output of this program is
Further details
Details of the java output library Db
may be found on Db
class
Details of the Michael Thomas Flanagan's total input library may be
found on Input and Output
Classes
Details of the Michael Thomas Flanagan's full library may be
found on Michael Thomas
Flanagan's Java Library