SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

AWT / NOTES</>↗
AWT20 Jan 2007

How do I get the available font family names?

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...

Wayan · 1 min read
AWT / NOTES</>↗
AWT16 Jan 2007

How do I get the available font names?

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 […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API13 Jan 2007

How do I parse a number for a locale?

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 […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API12 Jan 2007

How do I format a number for a locale?

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(); […...

Wayan · 1 min read
CORE API / NOTES</>↗
Core API11 Jan 2007

How do I iterate a subset of a string?

package org.kodejava.text; import java.text.CharacterIterator; import java.text.StringCharacterIterator; public class IterateSubstringExample { private static final String text = "How razorback-jumping frogs can level six piqued gymnasts"; public static void main(String[] args) { CharacterIterator it = new StringCharacterIterator(text, 4, 27, 5); // In this loop we just iterator a subset of character defined in the // StringCharacterIterator above. […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API08 Jan 2007

How do I reverse a string using CharacterIterator?

In this example we use the java.text.CharacterIterator implementation class java.text.StringCharacterIterator to reverse a string. It’s done by reading a string from the last index up to the beginning of the string. package org.kodejava.text; import java.text.CharacterIterator; import java.text.StringCharacterIterator; public class StringCharacterIteratorReverseExample { private static final String text = "Jackdaws love my big sphinx of quartz"; public […]

Wayan · 1 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.