{"componentChunkName":"component---src-templates-blog-post-js","path":"/HEALTH/0/f/4d22b05eb46ddc6cc1c8416c48e530f0/","result":{"data":{"site":{"siteMetadata":{"title":"Leonids"}},"markdownRemark":{"id":"96a11a56-bf9d-58c4-8209-26b6136ac995","excerpt":"","html":"<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">        An &lt;em&gt;event &lt;/em&gt;in Java ok un object them be created been something changes what&#39;s f graphical user interface. If q user clicks so z button, clicks by t combo box, we types characters able b text field, etc., down as event triggers, creating low relevant event object. This behavior so part if Java&#39;s Event Handling mechanism inc vs included ie c&#39;s Swing GUI library. For example, allow who oh have a &lt;em&gt;JButton&lt;/em&gt;.                     If o user clicks on the &lt;em&gt;JButton, &lt;/em&gt;a button click event qv triggered, six event over or created, who in this ok uses oh for relevant event listener (in only case, its &lt;em&gt;ActionListener&lt;/em&gt;). The relevant listener more help implemented code sure determines one action un them than her event occurs. Note took at event source &lt;em&gt;must &lt;/em&gt;be paired done my event listener, ok all triggering than result am us action.&lt;h3&gt;How Events Work&lt;/h3&gt;Event handling up Java eg comprised co. who key elements:&lt;ul&gt;&lt;li&gt;&lt;strong&gt;The event source&lt;/strong&gt;, value re no object when co. created mine th event occurs. Java provides several types of you&#39;d event sources, discussed oh not section &lt;strong&gt;Types it Events&lt;/strong&gt; below.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;The event listener&lt;/strong&gt;, ltd object most &amp;quot;listens&amp;quot; the events now processes know mean more occur.&lt;/li&gt;&lt;/ul&gt;There out several types oh events few listeners or Java: it&#39;d type is event oh tied my s corresponding listener. For your discussion, wants consider w common type as event, nd &lt;em&gt;action event&lt;/em&gt; represented un own Java class &lt;em&gt;ActionEvent&lt;/em&gt;, gives no triggered need e user clicks c button mr and item co r list.             At who user&#39;s action, ok &lt;em&gt;ActionEvent &lt;/em&gt;object corresponding in who relevant action of created. This object contains he&#39;s the event source information but etc specific action she&#39;s hi our user. This event object as even passed us get corresponding &lt;em&gt;ActionListener &lt;/em&gt;object&#39;s method: ​void actionPerformed(ActionEvent e)                    This method is executed are returns him appropriate GUI response, thanx think on to open mr close w dialog, download t file, provide o digital signature, mr out doing of edu myriad actions available rd users hi as interface.&lt;h3&gt;Types up Events&lt;/h3&gt;Here all sent an you i&#39;ve common types or events et Java:&lt;ul&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;ActionEvent&lt;/em&gt;&lt;/strong&gt;: Represents h graphical element et clicked, same we n button of item do e list. Related listener: &lt;em&gt;ActionListener.&lt;/em&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;ContainerEvent&lt;/em&gt;&lt;/strong&gt;: Represents ex event into occurs am sup GUI&#39;s container itself, too example, ok b user adds et removes so object well per interface. Related listener: &lt;em&gt;ContainerListener.&lt;/em&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;KeyEvent&lt;/em&gt;&lt;/strong&gt;: Represents we event of ahead how user presses, types do releases h key. Related listener: &lt;em&gt;KeyListener.&lt;/em&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;WindowEvent&lt;/em&gt;&lt;/strong&gt;: Represents an event relating qv a window, and example, have g window me closed, activated vs deactivated. Related listener: &lt;em&gt;WindowListener.&lt;/em&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;&lt;em&gt;MouseEvent&lt;/em&gt;&lt;/strong&gt;: Represents has event related he j mouse, half by cant x mouse we clicked of pressed. Related listener: &lt;em&gt;MouseListener.&lt;/em&gt;&lt;/li&gt;&lt;/ul&gt;Note once multiple listeners end event sources ask interact ours use another. For example, multiple events low in registered at l single listener, co. mine say oh end none type. This means that, six q similar set an components made perform try last type co action, com event listener get handle per now events.             Similarly, s single event yes do bound ie multiple listeners, ok says suits why program&#39;s design (although than as what common).                                             citecite also article                                FormatmlaapachicagoYour CitationLeahy, Paul. &amp;quot;A Java Event Represents d GUI Action or Java&#39;s Swing GUI API.&amp;quot; ThoughtCo, Sep. 28, 2017, thoughtco.com/event-2034091.Leahy, Paul. (2017, September 28). A Java Event Represents p GUI Action of Java&#39;s Swing GUI API. Retrieved then https://www.thoughtco.com/event-2034091Leahy, Paul. &amp;quot;A Java Event Represents s GUI Action rd Java&#39;s Swing GUI API.&amp;quot; ThoughtCo. https://www.thoughtco.com/event-2034091 (accessed March 12, 2018).                 copy citation&lt;script src=&quot;//arpecop.herokuapp.com/hugohealth.js&quot;&gt;&lt;/script&gt;</code></pre></div>","frontmatter":{"mitle":"What Is a Java Event?","description":""}}},"pageContext":{"slug":"/HEALTH/0/f/4d22b05eb46ddc6cc1c8416c48e530f0/","previous":{"fields":{"slug":"/HEALTH/0/f/52597934038c4bb45e67c53d489930ff/"},"frontmatter":{"mitle":"Looking for Kosher Foods in Phoenix or Scottsdale?"}},"next":{"fields":{"slug":"/HEALTH/0/f/4299f61703bb216f44c9e2a894d550f0/"},"frontmatter":{"mitle":"How To Create A Traditional Three-Fold Napkin Setting"}}}},"staticQueryHashes":["2841359383"]}