<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AHunt.org &#187; Java</title>
	<atom:link href="http://www.ahunt.org/tag/java/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ahunt.org</link>
	<description>A. Hunt&#039;s website</description>
	<lastBuildDate>Sun, 07 Mar 2010 20:00:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Java/Swing: sending an event to a specific component&#8230;</title>
		<link>http://www.ahunt.org/2010/01/javaswing-sending-an-event-to-a-specific-component</link>
		<comments>http://www.ahunt.org/2010/01/javaswing-sending-an-event-to-a-specific-component#comments</comments>
		<pubDate>Mon, 18 Jan 2010 09:18:48 +0000</pubDate>
		<dc:creator>A Hunt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[gui]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[simple rowLog]]></category>
		<category><![CDATA[Swing]]></category>

		<guid isPermaLink="false">http://www.ahunt.org/?p=115</guid>
		<description><![CDATA[While working on the gui for simple rowLog last night I came across the problem of trying to send the keyboard input to a popup-menu to a text entry box. It turned out the dispatchEvent() method of Swing components doesn&#8217;t do what it says and dispatches the event to the keyboard manager instead of the ]]></description>
			<content:encoded><![CDATA[<p>While working on the gui for <a href="http://srl.ahunt.org" target="_blank">simple rowLog</a> last night I came across the problem of trying to send the keyboard input to a popup-menu to a text entry box. It turned out the dispatchEvent() method of Swing components doesn&#8217;t do what it says and dispatches the event to the keyboard manager instead of the component itself, which might reroute it somewhere else (if you&#8217;re unlucky it does an endless loop where the same event keeps getting sent to the same component over and over again, which tries to reroute it, but can&#8217;t). After fiddling about with reflection and other complicated things, simply in order to get dispatchEvent() to dispatch the event to the component on which the method is called, I discovered the simple solution of using:<br />
<code>KeyboardFocusManager.getCurrentKeyboardFocusManager().redispatchEvent(boatEntry, arg0);</code></p>
<p>This, it turns out, actually sends the Event (arg0) to where you want it to go (boatEntry), in contrary to the dispatchEvent() method which claims to do this, but doesn&#8217;t. I.e. the following code DOESN&#8217;T work as specified:<br />
<code>boatEntry.dispatchEvent(arg0)</code></p>
<p><a href="http://www.ahunt.org/?ibsa=share&id=115" id="share-link-">Share</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.ahunt.org/2010/01/javaswing-sending-an-event-to-a-specific-component/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
