CORE API / NOTES</>↗Core API06 Apr 2009
This example show you how to use java.text.MessageFormat class to format a message that contains numbers. package org.kodejava.text; import java.text.MessageFormat; import java.util.Locale; public class MessageFormatNumber { public static void main(String[] args) { // Set the Locale for the MessageFormat. Locale.setDefault(Locale.US); // Use the default formatting for number. String message = MessageFormat.format("This is a {0} and […]
CORE API / NOTES</>↗Core API02 Apr 2009
Here we demonstrate how to use the java.text.MessageFormat class to format a message contains time information. package org.kodejava.text; import java.util.Date; import java.util.Calendar; import java.util.Locale; import java.text.MessageFormat; public class MessageFormatTime { public static void main(String[] args) { Date today = new Date(); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.HOUR, 7); Date next7Hours = calendar.getTime(); // We want the […]
CORE API / NOTES</>↗Core API29 Mar 2009
This example demonstrate how you can use the java.text.MessageFormat class to format a message with a date information in it. package org.kodejava.text; import java.util.Date; import java.util.Calendar; import java.util.Locale; import java.text.MessageFormat; public class MessageFormatDate { public static void main(String[] args) { Date today = new Date(); Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, 7); Date nextWeek = calendar.getTime(); […]
APACHE POI / NOTES</>↗Apache POI25 Mar 2009
The code below check if the first cell of an Excel file contains a date value. In Excel the cell type for date is returned as HSSFCell.CELL_TYPE_NUMERIC, to make sure if it contains a date we can use a utility method DateUtil.isCellDateFormatted(Cell cell), this method will check if the cell value is a valid date. […]
APACHE POI / NOTES</>↗Apache POI24 Mar 2009
In this example we try to obtain the Excel’s cell data type so that we can read the value using the right method. The data to be read is in a file named celltype.xls. The matrix below depict how the file is. | COL ROW | 0 1 2 3 4 —-|————————- 0 | 1 […]
APACHE POI / NOTES</>↗Apache POI20 Mar 2009
In this example we demonstrate how to read data from an Excel file. In this example we limit to read a string data only. After reading the data, iterating each row and cells of the Excel file we display the content to the program console. package org.kodejava.poi; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; […]