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.

CORE API / NOTES</>↗
Core API14 Oct 2009

How do I create a LinkedList?

A linked list is a fundamental data structure in programming. It can store data and a references to the next and/or to the previous node. There can be a singly linked list, a doubly linked list and a circularly linked list. The code below show you how to use the java.util.LinkedList class to create a […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing11 Oct 2009

How do I add selection listener to JTree?

This example shows you how to use the TreeSelectionListener to add a tree selection listener to the JTree component. In the listener method below you can see how to get the selected path and print out the selected path to the console. package org.kodejava.swing; import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; import java.awt.*; public class JTreeSelectionListenerDemo […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing07 Oct 2009

How do I change color of selected node in JTree?

This example show you how to change the color of the selected node of the JTree component. It shows you how to set the node background color, the font color and the selected node border color. To do this you need to obtain the DefaultTreeCellRenderer object from the JTree instance and modified the selection color […]

Wayan · 2 min read
SWING / NOTES</>↗
Swing03 Oct 2009

How do I use a JTree component?

The example introduce you how to use the JTree swing component to create a presentation of hierarchical data. The hierarchical data can be viewed in expand mode or collapse mode. To create an item of the tree we create an instance of DefaultMutableTreeNode which located in the javax.swing.tree package. This class implements the TreeNode and […]

Wayan · 3 min read
BASIC / NOTES</>↗
Basic29 Sep 2009

How do I get the remainder of a division?

The remainder or modulus operator (%) let you get the remainder of a division of two numbers. This operator can be used to obtain a reminder of an integer or floating point types. package org.kodejava.basic; public class RemainderOperatorDemo { public static void main(String[] args) { int a = 10; double b = 49; // The […]

Wayan · 1 min read
BASIC / NOTES</>↗
Basic26 Sep 2009

How do I use the ternary operator?

The ternary operator or conditional operator can be use as a short version of the if-then-else statement. When you have a simple if-then-else statement in your code that return a value you might use the ternary operator, it can make your code easier to read. The ternary operator is written using the symbol of ?: […]

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.