title: How to Check Mouse Click in 2D Graphics java.
body: <p>I need to make a code that will Draw a triangle. then user will click the inside or outside the triangle. and A dialogue box will be shown that "Click is inside the triangle" if it is. </p>
  
  <p>I have code to draw triangle, here is the code, now what to do. i dont know. if any one help then please. </p>
  
  <p>I have tried axis base but i did not come up with required result. </p>
  
  <pre><code>public void paintComponent(Graphics g)  
          {  
              Graphics2D g2 = (Graphics2D) g;  
              g2.draw(new Line2D.Double (150, 200, 200, 100)); 
              g2.draw(new Line2D.Double (100, 100, 150, 200));           
              g2.draw(new Line2D.Double (100, 100, 200, 100)); 
          }  
  </code></pre>
  
  <p>Output is here. 
  <img src="https://i.stack.imgur.com/b5fhS.jpg" alt="enter image description here"></p>