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.

MAIL / NOTES</>↗
Mail25 Apr 2012

How do I debug application that uses JavaMail APIs?

To ask Java mail to print out a debug message when you run a Java mail program you can add the mail.debug and set the value to true into the properties used to create the session object. The other way is to set the debug setting of the session using the session.setDebug() method and pass […]

Wayan · 4 min read
MAIL / NOTES</>↗
Mail09 Apr 2012

How do I validate email address using Java Mail API?

This code snippet shows you how to validate an email address using the javax.mail.internet.InternetAddress class. The validate() method throws a javax.mail.internet.AddressException when the email address passed to the constructor is not a valid email address. Here is the complete code snippet: package org.kodejava.mail; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; public class ValidateEmail { public static void main(String[] […]

Wayan · 2 min read
SPRING CORE / NOTES</>↗
Spring Core09 Apr 2012

How do I create default init-method and destroy method in Spring?

When many beans in a context definition will have the same initialization and destroy method name, you can define a default-init-method and default-destroy-method in the attributes of the beans element. This way you don’t have to define individual init-method and destroy-method for each of your beans. When the beans do not supply the method that […]

Wayan · 3 min read
CORE API / NOTES</>↗
Core API07 Apr 2012

How do I read file using FileInputStream?

The following example use the java.io.FileInputStream class to read contents of a text file. We’ll read a file located in the temporary directory defined by operating system. This temporary directory can be accessed using the java.io.tmpdir system property. package org.kodejava.io; import java.io.File; import java.io.FileInputStream; import java.io.IOException; public class FileInputStreamDemo { public static void main(String[] args) […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing23 Mar 2012

How do I disable keyboard events in JTextArea?

The following example demonstrate how to disable some keys in JTextArea and JScrollPane using the InputMap. In the disableKeys() method below we disable the arrow keys including the UP, DOWN, LEFT and RIGHT. Let’s see the code snippet below: package org.kodejava.swing; import javax.swing.*; import java.awt.*; public class TextAreaDisableKeyDemo extends JFrame { public TextAreaDisableKeyDemo() { initialize(); […]

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.