Cara menggunakannya mudah, contohnya:
Hasil tampilannya adalah sebagai berikut:
package indonesialocalesetting; import java.awt.EventQueue; import java.text.DateFormat; import java.util.Date; import java.util.Locale; import javax.swing.JDialog; import javax.swing.JOptionPane; /** * * @author UMAR */ public class IndonesiaLocaleSetting { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here EventQueue.invokeLater(new Runnable() { public void run() { JDialog.setDefaultLookAndFeelDecorated(true); Locale inLocale = new Locale("id", "ID"); DateFormat df = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, inLocale); String inCalendar = df.format(new Date()); JOptionPane.showMessageDialog(null, inCalendar, "Indonesia Locale Example", JOptionPane.WARNING_MESSAGE); } }); } }
Download Source code di sini.