Here you can find the source of inInsets(MouseEvent me)
public static boolean inInsets(MouseEvent me)
//package com.java2s; //License from project: Open Source License import java.awt.Insets; import java.awt.event.MouseEvent; import javax.swing.JComponent; public class Main { public static boolean inInsets(MouseEvent me) { JComponent comp = (JComponent) me.getComponent(); Insets insets = comp.getInsets(); if (me.getX() < insets.left || me.getX() > comp.getSize().width - insets.right || me.getY() < insets.top || me.getY() > comp.getSize().height - insets.bottom) { return true; }/*from w ww. j av a2 s. c o m*/ return false; } }