Java Abstract Window Toolkit (AWT)
User interaction is supported with the graphics you want to display. You need to be able to determine when the user clicks on one of them. To determine whether a mouse click occurred over a particular Shape object, The Graphics2D class provides a hit method. You can also get the location of the mouse click. Call the contains method on the Shape class to determine whether the click was within the bounds of the Shape.
You can perform simple hit testing, if you are using primitive text