Pages

about my opensource eclipse java applications recently i'm studying GWT and Android

Thursday, August 18, 2005

What is Insets?[GEF/Draw2D]


How many pixels inset a figure by a border on top,bottom,left and right.

Some layouts take care that value.
And I guess it help to know if a border was clicked.

Anyway,generally a border overdraw a figure in insets.



Maybe you could know if events happen inside a border like below.





public class MouseClicked extends MouseListener.Stub{

public void mousePressed(MouseEvent me) {
Figure figure=(Figure)me.getSource();
//I guess there are other better way.
if(figure.getBounds().contains(me.x,me.y) && !figure.getBounds().getCropped(figure.getInsets()).contains(me.x,me.y)){
shell.setText("click border");
}else{
shell.setText("click inside");
}
}

}