is Mouse Over JTree Path - Java Swing

Java examples for Swing:JTree

Description

is Mouse Over JTree Path

Demo Code


//package com.java2s;
import java.awt.event.MouseEvent;

import javax.swing.JTree;

public class Main {
    public static boolean isMouseOverTreePath(MouseEvent evt, JTree tree) {
        if (evt == null) {
            throw new NullPointerException("evt == null");
        }//  www .jav  a2  s.c  om
        if (tree == null) {
            throw new NullPointerException("tree == null");
        }
        return tree.getRowForLocation(evt.getX(), evt.getY()) > 0;
    }
}

Related Tutorials