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.

SWING / NOTES</>↗
Swing05 Sep 2010

How do I get the selected color from JColorChooser?

To get the selected color from JColorChooser we need to create an implementation of the ChangeListener interface. This interface provides a single method call stateChanged(ChangeEvent e). The instance of this interface implementation need to be passed to JColorChooser by calling the JColorChooser.getSelectionModel().addChangeListener() method. In this example our ChangeListener implementation get the selected color and replace […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing01 Sep 2010

How do I use JColorChooser component?

The JColorChooser is a Swing component that provides a palette from where we can select a color code in RGB format. The JColorChooser component has two parts, the tabbed pane of color selection and a preview box. The tabbed has three tabs which allows us to select a color from a swatches, a HSB (Hue, […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API27 Aug 2010

How do I change the date format symbols for a specified locale?

package org.kodejava.text; import java.text.DateFormatSymbols; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class ChangeDateFormatSymbols { public static void main(String[] args) { Locale id = new Locale("in", "ID"); String pattern = "EEEE, dd MMM yyyy"; Date today = new Date(); // Gets formatted date specify by the given pattern for // Indonesian Locale no changes for default […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API25 Aug 2010

How do I get a formatted date for a specific pattern and locale?

If you want to change formatting styles provided by DateFormat, you can use SimpleDateFormat class. The SimpleDateFormat class is locale-sensitive. If you instantiate SimpleDateFormat without a Locale parameter, it will format the date and time according to the default Locale. Both the pattern and the Locale determine the format. For the same pattern, SimpleDateFormat may […]

Wayan · 2 min read
CORE API / NOTES</>↗
Core API20 Aug 2010

How do I get default date and time format for a defined country?

The DateFormat class allows you to format dates and times with predefined styles in a locale-sensitive manner. Formatting dates or times with the DateFormat class is a two-step process. First, you create a formatter with the getDateInstance() method for formatting date or getTimeInstance() method for formatting time or getDateTimeInstance() when you want formatting both date […]

Wayan · 3 min read
CORE API / NOTES</>↗
Core API15 Aug 2010

How do I change the currency symbol?

This example show you how to change the currency symbol for the defined locale using the DecimalFormatSymbols.setCurrencySymbol() method. After changing the currency symbol, the DecimalFormatSymbols instance is passed to the DecimalFormat object which does the formatting. package org.kodejava.text; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.util.Locale; public class CurrencyFormatSymbols { public static vo...

Wayan · 2 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.