Search code examples
javacustom-controlsregion

Java user control region


I'm new to Java, and i'd like to know if Java has something similar to the C# region which defines which parts of the control's area should react to mouse event, etc.
(like in creating a round button...)
thanks :)


Solution

  • Yes. The method contains(int, int) in the java.awt.Component class is used to query a control to ask whether it contains a particular point, for the purposes of mouse processing. If you're defining a custom control, you can override this method to describe the shape.