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</>↗
Swing22 Aug 2007

How do I format JLabel using HTML?

JLabel text can be formatted using an HTML standard tags. The example below shows you how we can use and HTML font tag to change the font size, color and style of JLabel text. package org.kodejava.swing; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; import java.awt.Container; import java.awt.FlowLayout; public class JLabelHTMLStyle extends JFrame { public […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API21 Aug 2007

How do I get an exception stack trace message?

In this example we use the java.io.StringWriter and java.io.PrintWriter class to convert stack trace exception message to a string. package org.kodejava.io; import java.io.StringWriter; import java.io.PrintWriter; public class StackTraceToString { public static void main(String[] args) { try { int result = 10 / 0; } catch (Exception e) { // Create a StringWriter and a PrintWriter […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API21 Aug 2007

How do I read and write data in Windows registry?

The java.util.prefs package provides a way for applications to store and retrieve user and system preferences and data configuration. These preference data will be stored persistently in an implementation-dependent backing stored. For example in Windows operating system in will stored in Windows registry. To write and read these data we use the java.util.prefs.Preferences class. The […]

Wayan · 1 min read
SWING / NOTES</>↗
Swing19 Aug 2007

How do I display an image in JButton?

package org.kodejava.swing; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; import java.awt.FlowLayout; public class ButtonImageExample extends JFrame { public ButtonImageExample() { initComponents(); } public static void main(String[] args) { SwingUtilities.invokeLater(() -> new ButtonImageExample().setVisible(true)); } private void initComponents() { setTitle("My Butt...

Wayan · 1 min read
SWING / NOTES</>↗
Swing18 Aug 2007

How do I use JFormattedTextField to format user input?

The JFormattedTextField allows us to create a text field that can accept a formatted input. In this code snippet we create two formatted text fields that accept a valid phone number and a date. package org.kodejava.swing; import javax.swing.JFormattedTextField; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; import javax.swing.text.DateFormatter; import javax.swing.text.MaskFormatter; import java.awt.Dimension; import java.awt...

Wayan · 2 min read
JDBC / NOTES</>↗
JDBC14 Aug 2007

How do I make updates in updatable ResultSet?

Using an updatable result set enables our program to update record in the database from the ResultSet object. The operation on the ResultSet object can be updated, inserted or deleted. With this mechanism, we can update a database without executing a query. In the example below we have a product table with the id, code, […]

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