Posts

Showing posts with the label java

State the use of tree component in application in Java

Image
JTree basic tutorial and examples Written by   Nam Ha Minh Last Updated on 06 July 2019   |    Print   Email This article explains working with JTree and proceeds to show some examples. We will write code to achieve a JTree output like: Output Table of Contents: 1.Introduction 2.Developing a Simple JTree 3.Adding More Children 4.Customizing Tree's Display 5.Adding a Scrollpane 6.Showing Root Handles 7.Hiding Root Node 8.Changing Visual Icons 9.Event Handlers   1. Introduction to JTree: JTree is a Swing component with which we can display hierarchical data. JTree is quite a complex component. A JTree has a 'root node' which is the top-most parent for all nodes in the tree. A node is an item in a tree. A node can have many children nodes. These children nodes themselves can have further children nodes. If a node doesn't have any children node, it is called a leaf node. The leaf node is displayed with a different visual in