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.

LOGGING / NOTES</>↗
Logging17 Feb 2009

How do I do a conditional logging?

When logging some messages in our application the purpose could be creating a log for debugging purposes. To minimize the impact of these debug message we can use a conditional logging. To do this we need to wrap each call to the logger method with a Logger.isLoggable(Level level) check. The check will ensure that only […]

Wayan · 2 min read
LOGGING / NOTES</>↗
Logging16 Feb 2009

How do I log an exception?

In this example you can see how we can log an exception when it occurs. In the code below we are trying to parse an invalid date which will give us a ParseException. To log the exception we call the Logger.log() method, passes the logger Level, add some user-friendly message and the Throwable object. package […]

Wayan · 2 min read
LOGGING / NOTES</>↗
Logging12 Feb 2009

How do I check if a message is loggable?

The Logger class provide a setLevel() method to set the logging level. By setting logging to a certain level we can control which message will be logged. To determine or check if a message will be logged we can use the Logger.isLoggable(Level level) method. Let see the example below. package org.kodejava.util.logging; import java.util.logging.Logger; import java.util.logging.Level; […]

Wayan · 2 min read
LOGGING / NOTES</>↗
Logging09 Feb 2009

How do I obtain or create a Logger?

Since JDK 1.4 a logging API was introduced into the Java class libraries. This API enables our application to logs some messages to record our application activities. To create an instance of Logger we can call the Logger.getLogger() factory method which will return the available logger for the given namespace, or it will create a […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing08 Feb 2009

How do I create a compound border?

In this example we create a compound border, a border around border. Here, instead of creating a new instance of Border class directly we create the border using the BorderFactory factory class. package org.kodejava.swing; import javax.swing.*; import javax.swing.border.BevelBorder; import javax.swing.border.Border; import java.awt.*; public class CompoundBorderExample extends JFrame { public CompoundBorderExample() { initializeUI(); } public static […]

Wayan · 1 min read
SWING / NOTES</>↗
Swing05 Feb 2009

How do I add a title to a border?

This example shows you how to create a border that have a title in it. There is a special border class the TitledBorder that does this. We can define the justification of the title, left, centered or right justify. To do this we call the setTitleJustification() method. We can also set other attributes such as […]

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.