CORE API / CATATAN</>↗Core API23 Jan 2007
This example shows us how to use the System.nanoTime() method to get the amount of time a process take place. Please be aware that the nano time value is not related to the real world time value. package org.kodejava.lang; public class ElapsedTimeExample { public static void main(String[] args) { // Get the start time of […]
APPLET / CATATAN</>↗Applet20 Jan 2007
The code below demonstrate the very basic of Java applet. Applet is a small Java application that can be embedded on the web browser. package org.kodejava.applet; import java.applet.*; import java.awt.*; public class HelloWorldApplet extends Applet { public void init() { } public void start() { } public void stop() { } public void destroy() { […]
AWT / CATATAN</>↗AWT20 Jan 2007
package org.kodejava.awt; import java.awt.GraphicsEnvironment; public class FontFamilyNameList { public static void main(String[] args) { // Get all available font family names from GraphicsEnvironment GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); String[] familyNames = ge.getAvailableFontFamilyNames(); // Iterates familyNames array to display the available font's family names for (String familyName : familyNames) { System.out.println("Family nam...
AWT / CATATAN</>↗AWT16 Jan 2007
package org.kodejava.awt; import java.awt.Font; import java.awt.GraphicsEnvironment; public class FontNameList { public static void main(String[] args) { // Get all available fonts from GraphicsEnvironment GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); Font[] fonts = ge.getAllFonts(); // Iterates all available fonts and get their name and family name for (Font font : fonts) { String fontName = font.getName(); String familyName […]
CORE API / CATATAN</>↗Core API13 Jan 2007
package org.kodejava.text; import java.util.Locale; import java.text.NumberFormat; import java.text.ParseException; public class LocaleNumberParse { public static void main(String[] args) { try { // In this example we are trying to parse a number string in a // defined format. Basically we want to covert the string for a // locale into a correct number value. Number number […]
CORE API / CATATAN</>↗Core API12 Jan 2007
package org.kodejava.text; import java.util.Locale; import java.text.NumberFormat; public class LocaleNumberFormat { public static void main(String[] args) { // Format number for Italy locale. In Italy locale the decimal point // symbol is a comma. NumberFormat formatter = NumberFormat.getNumberInstance(Locale.ITALY); try { String number = formatter.format(195325.75); System.out.println("Number in Italy: " + number); } catch (NumberFormatException e) { e.printStackTrace(); […...