{"id":227,"date":"2010-04-25T18:57:00","date_gmt":"1970-01-01T00:00:00","guid":{"rendered":"http:\/\/www.yazilimmutfagi.com\/?p=227"},"modified":"2010-04-25T18:57:00","modified_gmt":"1970-01-01T00:00:00","slug":"javada-mouseclicked-olayi","status":"publish","type":"post","link":"https:\/\/www.yazilimmutfagi.com\/index.php\/2010\/04\/25\/javada-mouseclicked-olayi\/","title":{"rendered":"Java&#8217;da mouseClicked olayi"},"content":{"rendered":"<p>&nbsp;Uygulamamizin amaci farenin imleci ile ufak ufak <a href=\"http:\/\/www.yazilimmutfagi.com\/MakaleOku.aspx?Makale=Java+Grafik+K%C3%BCt%C3%BCphanesini+Kullanarak+Kare+ve+Daire+%C3%87izmek&amp;MakaleKey=d23bb7e2-da1e-4a7e-be9c-25e6f8c281ce\">kareler &ccedil;izmek <\/a>olsun.<\/p>\n<p>Ekran &ccedil;iktisi su sekilde olacak:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"409\" height=\"398\" src=\"http:\/\/www.yazilimmutfagi.com\/yuklenendosyalar\/image\/Java%20mouseClicked.png\" alt=\"\" \/><br \/>\n<a href='www.yazilimmutfagi.com'>.<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Kodlarimiz ise su sekilde:<\/p>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\">import java.awt.*;    <\/meta>\n<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">import java.awt.Event.*;<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">import java.awt.event.MouseAdapter;<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">import java.awt.event.MouseEvent;<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">import javax.swing.JFrame;<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">public class Mouse extends JFrame {<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;int x=0, y=0;<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;public static void main(String[] args){\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;Mouse m = new Mouse();\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;m.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;}<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;Mouse(){\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;super(&quot;mouseClicked olayi&quot;);\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;setSize(200,200);\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;addMouseListener(new MouseKontrolu());\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;setVisible(true);\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;}<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">@Override\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;public void paint(<a href=\"http:\/\/www.yazilimmutfagi.com\/MakaleOku.aspx?Makale=Java+Grafik+K%C3%BCt%C3%BCphanesini+Kullanarak+Kare+ve+Daire+%C3%87izmek&amp;MakaleKey=d23bb7e2-da1e-4a7e-be9c-25e6f8c281ce\">Graphics<\/a> g){\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;g.setColor(Color.BLACK);\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;if(x&gt;5 &amp;&amp; y&gt;5)\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\">\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\">       <\/meta>\n<\/meta>\n<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;g.drawRect(x,y,10,10);\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\">\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\">       <\/meta>\n<\/meta>\n<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;}<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">class MouseKontrolu extends MouseAdapter{<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">@Override\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;public void mouseClicked(MouseEvent e){\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;x=e.getX();\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;y=e.getY();\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;repaint();<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">\n<meta content=\"text\/html; charset=utf-8\" http-equiv=\"content-type\" \/><\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;&nbsp; &nbsp; &nbsp;}<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">}<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">}\/\/end class<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;<\/div>\n<div style=\"margin-bottom: 0cm; background: none repeat scroll 0% 0% rgb(230, 230, 230);\">&nbsp;<\/div>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>Java&#39;da mauseClicked olayina bir &#246;rnek. <\/p>\n","protected":false},"author":519,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[419],"tags":[5564,4194,5320,5833,5984,4931,4585],"_links":{"self":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/posts\/227"}],"collection":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/users\/519"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/comments?post=227"}],"version-history":[{"count":0,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/posts\/227\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/media?parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/categories?post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yazilimmutfagi.com\/index.php\/wp-json\/wp\/v2\/tags?post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}