In this section, you will learn to open an icon in JTree. That means when you click any node of a tree, icon will be displayed on the frame.
The following program displays icons when you click the node of JTree. For this you need an icon to be displayed on the frame. Program uses the makeIcon() method to create a UIDefaults and an ImageIcon UIResource for the given specified gif file.The LookAndFeel plugins these component Finally, the UIManager class keeps the current look and feel of he given image to be showed, if you click any node of the tree.
The UIManager class keeps the current look and feel and its defaults which are as follows:.
Here is the code of this program:
Output this program:
Liked it! Share this Tutorial