SWING / CATATAN</>↗Swing17 Des 2008
A JComboBox allows user to select a value from a drop-down items available in the component. When the combo box set to editable user can enter their own value by typing it directly in the combo box editor. The code below demonstrate how you can create a simple combo box component. package org.kodejava.swing; import javax.swing.*; […]
APACHE POI / CATATAN</>↗Apache POI15 Des 2008
This example demonstrate how to use HSSFCellStyle and HSSFFont to format the cell style in Excel document. Using this class we can define cell border, foreground and background color. We can also define the font we used to display the cell value. package org.kodejava.poi; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.util.HSSFColor; import org.apache.poi.ss.usermodel.BorderStyle; import org.apache.poi.ss.usermodel.FillPatternType; import java.io.FileOutpu...
APACHE POI / CATATAN</>↗Apache POI15 Des 2008
This example demonstrate how to create an Excel document using Apache POI library. In this example we create a simple document containing two sheets which have a value on their first cell. package org.kodejava.poi; import org.apache.poi.hssf.usermodel.*; import java.io.FileOutputStream; import java.io.IOException; public class CreateExcelDemo { public static void main(String[] args) { // Creating an instance of […]
ITEXT PDF / CATATAN</>↗iText PDF14 Des 2008
This example is the first example of the iText PDF series, we are going to start by learning to use the iText PDF library to create a PDF document. We will see how to use the Document class, getting an instance of PdfWriter, creating a simple Paragraph and set the text alignment and the font. […]
CORE API / CATATAN</>↗Core API11 Des 2008
The code below detect if a given string has a non ASCII characters in it. We use the CharsetDecoder class from the java.nio package to decode string to be a valid US-ASCII charset. package org.kodejava.io; import java.nio.charset.CharsetDecoder; import java.nio.charset.CharacterCodingException; import java.nio.CharBuffer; import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.Arrays; public class NonAsciiValidation { public static void main(Str...
HIBERNATE / CATATAN</>↗Hibernate09 Des 2008
This example demonstrate the use of Hibernate’s Restriction.in criterion. This restriction will query for some record based on a collection of parameter defined for a specific property of the bean. package org.kodejava.hibernate; import org.hibernate.SessionFactory; import org.hibernate.Session; import org.hibernate.HibernateException; import org.hibernate.Criteria; import org.hibernate.cfg.Configuration; import org.hibernate.criterion.Restrictions; import org.kodejava.hibern...