Single Selection in JTree in Java Swing Application

package com.demo;

import javax.swing.JTree;
import javax.swing.tree.TreeSelectionModel;

public class JFrameDemo {

    public static void main(String[] args) {

        JTree jtreeCategory = new JTree();
        jtreeCategory.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    }

}