<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Off The Top Of My Head</title>
	<atom:link href="http://waltermilner.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://waltermilner.wordpress.com</link>
	<description>Don&#039;t open it</description>
	<lastBuildDate>Fri, 13 Nov 2009 15:22:01 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='waltermilner.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/b44a15b2fa7eb4a7da92d7789987d5e1?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Off The Top Of My Head</title>
		<link>http://waltermilner.wordpress.com</link>
	</image>
			<item>
		<title>Green belt grab</title>
		<link>http://waltermilner.wordpress.com/2009/11/13/green-belt-grab/</link>
		<comments>http://waltermilner.wordpress.com/2009/11/13/green-belt-grab/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 15:22:01 +0000</pubDate>
		<dc:creator>waltermilner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Coventry]]></category>
		<category><![CDATA[Keresley]]></category>
		<category><![CDATA[green belt]]></category>

		<guid isPermaLink="false">http://waltermilner.wordpress.com/?p=212</guid>
		<description><![CDATA[Please help &#8211; Coventry City Council are intending to build 35000 houses, many of them on green belt land:
www.greenbeltgrab.org.uk 
www.keresleyvillages.org.uk
www.save-coventry-greenbelt.co.uk 
Please pass this on to as many people as possible, especially if you have/had Coventry links
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=212&subd=waltermilner&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h3>Please help &#8211; Coventry City Council are intending to build 35000 houses, many of them on green belt land:<br />
<a href="http://www.greenbeltgrab.org.uk" target="_blank">www.greenbeltgrab.org.uk </a><br />
<a href="http://www.keresleyvillages.org.uk" target="_blank">www.keresleyvillages.org.uk</a><br />
<a href="http://www.save-coventry-greenbelt.co.uk" target="_blank">www.save-coventry-greenbelt.co.uk </a><br />
Please pass this on to as many people as possible, especially if you have/had Coventry links</h3>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waltermilner.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waltermilner.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waltermilner.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waltermilner.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waltermilner.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waltermilner.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waltermilner.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waltermilner.wordpress.com/212/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waltermilner.wordpress.com/212/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waltermilner.wordpress.com/212/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=212&subd=waltermilner&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waltermilner.wordpress.com/2009/11/13/green-belt-grab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9d1cd29e1482533ded586b3a66c70ac0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waltermilner</media:title>
		</media:content>
	</item>
		<item>
		<title>Shadowed text with CSS</title>
		<link>http://waltermilner.wordpress.com/2009/11/03/shadowed-text-with-css/</link>
		<comments>http://waltermilner.wordpress.com/2009/11/03/shadowed-text-with-css/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 15:37:31 +0000</pubDate>
		<dc:creator>waltermilner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DHTML]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[drop shadow]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Krijn Hoetmer]]></category>
		<category><![CDATA[menu bars]]></category>
		<category><![CDATA[shadowed text]]></category>

		<guid isPermaLink="false">http://waltermilner.wordpress.com/?p=208</guid>
		<description><![CDATA[The target was to make a navigation bar like that at www.apple.com, which looks like this:
They did this by having all the links share a single background image, with the x and y offsets for each set so they show the correct part of that single image. In turn the text shadowing has been done [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=208&subd=waltermilner&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The target was to make a navigation bar like that at www.apple.com, which looks like this:</p>
<div id="attachment_209" class="wp-caption alignleft" style="width: 518px"><img class="size-full wp-image-209" title="apple" src="http://waltermilner.files.wordpress.com/2009/11/apple.jpg?w=508&#038;h=96" alt="apple navbar" width="508" height="96" /><p class="wp-caption-text">Apple navbar</p></div>
<p>They did this by having all the links share a single background image, with the x and y offsets for each set so they show the correct part of that single image. In turn the text shadowing has been done in the graphics package that made the image.</p>
<p>I wanted something like this that could be done using CSS, without having to handcraft a background image for each link. That&#8217;s what we&#8217;re trying to do.</p>
<p>Thanks to Krijn Hoetmer I had a JavaScript function which would shadow some text. But the first problem would be that I would need to put both a JavaScript link and a style sheet link in the HTML &#8211; I wanted just one link. After some Googling and experimenting I had some JS which would dynamically load a style sheet:</p>
<address>var cssNode = document.createElement(&#8216;link&#8217;);</address>
<address>cssNode.type = &#8216;text/css&#8217;;</address>
<address>cssNode.rel = &#8217;stylesheet&#8217;;</address>
<address>cssNode.href = &#8216;menuBar1.css&#8217;;</address>
<address>cssNode.media = &#8217;screen&#8217;;</address>
<address>cssNode.title = &#8216;dynamicLoadedSheet&#8217;;</address>
<address>document.getElementsByTagName(&#8220;head&#8221;)[0].appendChild(cssNode);</address>
<p>So menuBar1.css would style the menu bar, and this JS would load it.</p>
<p>Next task is to shadow the text on eack link. This works by getting the div which encloses the menu, getting each of the child nodes, and calling the shadow function for each one:</p>
<address>var menu=document.getElementById(&#8220;menu&#8221;);</address>
<address>var children=menu.childNodes;</address>
<address>for (i=0; i&lt;children.length; i++)</address>
<address> {</address>
<address> applyShadow(children[i], &#8216;white&#8217;, 3,10, 7);</address>
<address> }</address>
<p>The applyShadow function is originally by Krijn Hoetmer is modified here slightly, to handle text which has some padding (third and fourth parameters are teh left and top padding:</p>
<address>function applyShadow(targetElement, shadowColor, shadowOffset,pside, ptop) {</address>
<address> if (typeof(targetElement) != &#8216;object&#8217;) {</address>
<address> targetElement = document.getElementById(targetElement);</address>
<address> }</address>
<address> var value = targetElement.firstChild.nodeValue;</address>
<address> targetElement.style.position = &#8216;relative&#8217;;</address>
<address> targetElement.style.zIndex = 1;</address>
<address> var newEl = document.createElement(&#8217;span&#8217;);</address>
<address> newEl.appendChild(document.createTextNode(value));</address>
<address> newEl.className = &#8217;shadowed&#8217;;</address>
<address> newEl.style.color = shadowColor;</address>
<address> newEl.style.position = &#8216;absolute&#8217;;</address>
<address> newEl.style.left = &#8216;0px&#8217;;</address>
<address> newEl.style.top = shadowOffset + &#8216;px&#8217;;</address>
<address> newEl.style.zIndex = -1;</address>
<address> newEl.style.paddingLeft=pside+1+&#8221;px&#8221;;</address>
<address> newEl.style.paddingTop=ptop+1+&#8221;px&#8221;;</address>
<address> targetElement.appendChild(newEl);</address>
<p>}</p>
<p>The HTML this is applying to is:</p>
<p>&lt;div id=&#8221;menu&#8221;&gt;&lt;a href=&#8221;nowhere&#8221; &gt;Link One&lt;/a&gt;&lt;a href=&#8221;nowhere&#8221;&gt;Link Two&lt;/a&gt;&lt;a href=&#8221;nowhere&#8221;&gt;Link Three&lt;/a&gt;&lt;a href=&#8221;nowhere&#8221;&gt;Link Four&lt;/a&gt;&lt;/div&gt;</p>
<p>This is all done in one line &#8211; any spaces or CRs produce spurious white space text nodes in the DOM tree.</p>
<p>This shadows the text &#8211; but we need to insert graphics for the link separators.  This is a rather bizarre loop:</p>
<address>var count = children.length;</address>
<address>for (i=0; i&lt;count*2; i++)</address>
<address>{ </address>
<address> var image = document.createElement(&#8216;img&#8217;);</address>
<address> image.setAttribute(&#8217;src&#8217;,'images/gap.gif&#8217;);</address>
<address> menu.insertBefore(image,children[i]);</address>
<address> i++;</address>
<address>}</address>
<p>we go for twice the number of child nodes that are there &#8211; because when we&#8217;ve finished, we&#8217;ll have twice that number. And we go i++ every time we add one. children is dynamically updated as we add nodes.</p>
<p>The style sheet is</p>
<address>#menu</address>
<address>{</address>
<address> position: absolute;</address>
<address> left: 20%;</address>
<address> right: 20%;</address>
<address> min-width: 32%;</address>
<address> background-image: url(images/linkbg.gif);</address>
<address> -moz-border-radius: 5px;</address>
<address> text-align: center;</address>
<address> height: 37px; </address>
<address>}</address>
<address>
#menu a</address>
<address>{</address>
<address> position:relative;</address>
<address> color: black;</address>
<address> font-family: arial, helvetica, sans-serif;</address>
<address> font-size:11px;</address>
<address> padding-left: 10px;</address>
<address> padding-top: 10px;</address>
<address> padding-bottom:10px;</address>
<address> top:-15px; </address>
<address>}</address>
<p>The background image is 37 pixels high. We&#8217;ll only get round corners in FF &#8211; that&#8217;s IE&#8217;s problem. The result is:</p>
<div id="attachment_210" class="wp-caption alignleft" style="width: 477px"><img class="size-full wp-image-210" title="menu" src="http://waltermilner.files.wordpress.com/2009/11/menu.jpg?w=467&#038;h=86" alt="menu bar" width="467" height="86" /><p class="wp-caption-text">My version</p></div>
<p>Works in FF and IE</p>
<p>&nbsp;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waltermilner.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waltermilner.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waltermilner.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waltermilner.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waltermilner.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waltermilner.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waltermilner.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waltermilner.wordpress.com/208/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waltermilner.wordpress.com/208/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waltermilner.wordpress.com/208/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=208&subd=waltermilner&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waltermilner.wordpress.com/2009/11/03/shadowed-text-with-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9d1cd29e1482533ded586b3a66c70ac0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waltermilner</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/11/apple.jpg" medium="image">
			<media:title type="html">apple</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/11/menu.jpg" medium="image">
			<media:title type="html">menu</media:title>
		</media:content>
	</item>
		<item>
		<title>Height of divs</title>
		<link>http://waltermilner.wordpress.com/2009/09/15/height-of-divs/</link>
		<comments>http://waltermilner.wordpress.com/2009/09/15/height-of-divs/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 16:05:19 +0000</pubDate>
		<dc:creator>waltermilner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[web pages]]></category>

		<guid isPermaLink="false">http://waltermilner.wordpress.com/?p=200</guid>
		<description><![CDATA[In a CSS style sheet its common to center the content by having a div with an id styled like
#outer
{
position: relative;
width: 400px;
margin: auto;
background-color: rgb(1,0,104);
border: 5px white solid;
}
which is 400 wide and centered. But what height? You can fix the height, but if you want it to work with any content, there is an &#8216;issue&#8217;. By [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=200&subd=waltermilner&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In a CSS style sheet its common to center the content by having a div with an id styled like</p>
<p>#outer<br />
{<br />
position: relative;<br />
width: 400px;<br />
margin: auto;<br />
background-color: rgb(1,0,104);<br />
border: 5px white solid;<br />
}</p>
<p>which is 400 wide and centered. But what height? You can fix the height, but if you want it to work with any content, there is an &#8216;issue&#8217;. By default a div goes &#8216;height:auto;&#8217;, and expands to enclose its content. This works &#8211; sort of. Suppose the html is<br />
&lt;div id=&#8221;outer&#8221;&gt;</p>
<p>blah blah blah</p>
<p>blah blah&lt;/div&gt;</p>
<p>then you see:</p>
<p><img class="alignleft size-full wp-image-201" title="pic1" src="http://waltermilner.files.wordpress.com/2009/09/pic1.png?w=433&#038;h=68" alt="pic1" width="433" height="68" /></p>
<p>so the outer div has expanded. Now suppose you put another div inside the outer div:<br />
&lt;div id=&#8221;outer&#8221;&gt;<br />
&lt;div id=&#8221;title&#8221;&gt;The title&lt;br/&gt;on two lines&lt;/div&gt;<br />
blah blah blah<br />
blah blah<br />
&lt;/div&gt;</p>
<p>and title is styled</p>
<p>#title<br />
{<br />
border: thin red solid;<br />
}</p>
<p>then we see:</p>
<p><img class="alignleft size-full wp-image-202" title="pic2" src="http://waltermilner.files.wordpress.com/2009/09/pic2.png?w=474&#038;h=106" alt="pic2" width="474" height="106" /></p>
<p>still correct. Now suppose we position title absolute, like this:</p>
<p>#title<br />
{<br />
position: absolute;<br />
top:20px;<br />
left:50px;<br />
border: thin red solid;<br />
}</p>
<p>Now we see:</p>
<p><img class="alignleft size-full wp-image-203" title="pic3" src="http://waltermilner.files.wordpress.com/2009/09/pic3.png?w=453&#038;h=99" alt="pic3" width="453" height="99" /></p>
<p>The browser is not clever enough to work out what height it would need to be to enclose the inner div &#8211; it has given up. So you can&#8217;t use absolute positioning if you want the containing div to work out its correct height.</p>
<p>If you use relative positioning &#8211; the containing div height is correct, according to the &#8216;initial&#8217; position of the inner div, before its moved, as it were. For example, if you had</p>
<p>#title<br />
{<br />
position: relative;<br />
top:20px;<br />
left:50px;<br />
border: thin red solid;<br />
}</p>
<p>you see:</p>
<p><img class="alignleft size-full wp-image-204" title="pic4" src="http://waltermilner.files.wordpress.com/2009/09/pic4.png?w=503&#038;h=108" alt="pic4" width="503" height="108" /></p>
<p>The browser has left room for it in its initial position, above the &#8216;blah blah&#8217;.</p>
<p>So this is OK for left-right positioning. What if we want it not at the top? Set a margin-top:</p>
<p>#title<br />
{<br />
position: relative;<br />
top:0px;<br />
left:50px;<br />
width: 100px;<br />
margin-top:50px;<br />
border: thin red solid;<br />
}</p>
<p>and you get:</p>
<p><img class="alignleft size-full wp-image-205" title="pic5" src="http://waltermilner.files.wordpress.com/2009/09/pic5.png?w=458&#038;h=161" alt="pic5" width="458" height="161" /></p>
<p>This took me all afternoon. Ha!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waltermilner.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waltermilner.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waltermilner.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waltermilner.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waltermilner.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waltermilner.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waltermilner.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waltermilner.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waltermilner.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waltermilner.wordpress.com/200/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=200&subd=waltermilner&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waltermilner.wordpress.com/2009/09/15/height-of-divs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9d1cd29e1482533ded586b3a66c70ac0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waltermilner</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/09/pic1.png" medium="image">
			<media:title type="html">pic1</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/09/pic2.png" medium="image">
			<media:title type="html">pic2</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/09/pic3.png" medium="image">
			<media:title type="html">pic3</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/09/pic4.png" medium="image">
			<media:title type="html">pic4</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/09/pic5.png" medium="image">
			<media:title type="html">pic5</media:title>
		</media:content>
	</item>
		<item>
		<title>JavaScript and OOP for the DOM</title>
		<link>http://waltermilner.wordpress.com/2009/08/30/javascript-and-oop-for-the-dom/</link>
		<comments>http://waltermilner.wordpress.com/2009/08/30/javascript-and-oop-for-the-dom/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 16:33:48 +0000</pubDate>
		<dc:creator>waltermilner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[eye candy]]></category>
		<category><![CDATA[HML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[OOP]]></category>

		<guid isPermaLink="false">http://waltermilner.wordpress.com/?p=196</guid>
		<description><![CDATA[I wanted a color transition effect on web page elements when the mouse cursor passed over them &#8211; like a:hover, but for any element, not just a link, and a transition over say 0.8 seconds, not just an abrupt change. onmouseout should transition to the original color of the element.
This can be done using onmouseover [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=196&subd=waltermilner&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I wanted a color transition effect on web page elements when the mouse cursor passed over them &#8211; like a:hover, but for any element, not just a link, and a transition over say 0.8 seconds, not just an abrupt change. onmouseout should transition to the original color of the element.</p>
<p>This can be done using onmouseover and onmouseout, but I wanted to set it up for elements of a given tag, class or id. So (after only 2 days) I did it using OOP in JavaScript &#8211; listing below. I define a class (strictly a prototype) called ColorP, which will have the behaviour I want, and associate some web page elements with instances of this class.   One tricky point is that the method to change the color has to be recursive, and it was difficult to find the syntax for this. Thanks to Pablo Cabrera for &#8216;arguments.callee&#8217;, which must be one of the obscurer backwaters of JavaScript.</p>
<p>The web page body is:</p>
<p>&lt;p id=&#8221;test&#8221; style=&#8221;color: rgb(0,255,0);  background: #ff00ff&#8221; Hello&lt;/p&gt;</p>
<p>&lt;h1 id=&#8221;two&#8221; &#8220;&gt;Goodbye&lt;/h1&gt;</p>
<p>The body onload calls:</p>
<p>function start()<br />
{<br />
obj1 = new ColorP(&#8220;test&#8221;);<br />
obj2=new ColorP(&#8220;two&#8221;);<br />
return;<br />
}</p>
<p>So 2 objects are created associated with these two elements. We could have traversed the document tree and done this for given tags or classes. The code for ColorP objects is:</p>
<p>function ColorP(id)<br />
{<br />
// data members ///////////////////////////////////////////<br />
var obj;<br />
// time in mS delay before each recursive call<br />
var timeStep;<br />
// initial colors<br />
var red, green, blue;<br />
// color change each step<br />
var rDiff, gDiff, bDiff;<br />
// current color<br />
var red1, green1, blue1;<br />
// target colours and time for transition<br />
var r,g,b,time;<br />
// count and count1 count the transition steps<br />
var count, count1;</p>
<p>// two methods /////////////////////////////////////////////<br />
this.fadeIn = function()<br />
{<br />
if (count==10) {<br />
count=0;<br />
return;<br />
}<br />
count++;<br />
red1+=rDiff;<br />
green1+=gDiff;<br />
blue1+=bDiff;<br />
// set colors to integer values<br />
intR = Math.round(red1);<br />
intG = Math.round(green1);<br />
intB = Math.round(blue1);<br />
obj.style.color=&#8221;rgb(&#8220;+intR+&#8221;,&#8221;+intG+&#8221;,&#8221;+intB+&#8221;)&#8221;;<br />
setTimeout(arguments.callee, timeStep);<br />
}</p>
<p>this.fadeBack = function()<br />
{<br />
if (count1==10) {<br />
count1=0;<br />
return;<br />
}<br />
count1++;<br />
red1-=rDiff;<br />
green1-=gDiff;<br />
blue1-=bDiff;<br />
// set colors to integer values<br />
intR = Math.round(red1);<br />
intG = Math.round(green1);<br />
intB = Math.round(blue1);<br />
obj.style.color=&#8221;rgb(&#8220;+intR+&#8221;,&#8221;+intG+&#8221;,&#8221;+intB+&#8221;)&#8221;;<br />
setTimeout(arguments.callee, timeStep);<br />
}</p>
<p>// cnstructor code ///////////////////////////////////////<br />
r=255; // could be passed as constructor parameters<br />
g=0;<br />
b=45;<br />
time=0.7;<br />
// we will do this in 10 steps<br />
// so time for each step = time * 100 milliseconds<br />
timeStep = time*100;<br />
count=0;<br />
count1=0;<br />
obj=document.getElementById(id);<br />
// get colors<br />
styles=obj.getAttribute(&#8220;style&#8221;);<br />
cols=getColorFromStyles(styles);<br />
if (cols==null) return; // do nothing if can&#8217;t obtain color&#8217;<br />
// change to numbers<br />
red=parseFloat(cols[0]);<br />
green=parseFloat(cols[1]);<br />
blue=parseFloat(cols[2]);<br />
// work out colour change amounts<br />
rDiff=(r-red)/10.0;<br />
gDiff=(g-green)/10.0;<br />
bDiff=(b-blue)/10.0;<br />
// set current colors to the initial ones<br />
red1=red;<br />
green1=green;<br />
blue1=blue;</p>
<p>obj.onmouseover=this.fadeIn;<br />
obj.onmouseout=this.fadeBack;</p>
<p>}</p>
<p>Unfortunately the code to get the color style is different for IE:</p>
<p>// get foreground color from a set of style attributes<br />
// this returns an array of 3 values &#8211; the rgb components<br />
// it works for colors ONLY in the form rgb(a,b,c). If there<br />
// are no styles, or no color defined, it returns<br />
// the equivalent of black<br />
function getColorFromStyles(styles)<br />
{<br />
// in IE, styles is a style object, and styles.color yields the color<br />
// in FF and Opera, styles is a string like &#8216;color:rgb(1,2,3); background: rgb(4,5,6)&#8217;<br />
c=styles.color;<br />
if ( c == undefined ) // NOT IE, so get color:.. out of the string<br />
{<br />
if (styles==null)<br />
return new Array(0,0,0);<br />
// split on ; to separate attributes</p>
<p>pairs=styles.split(&#8220;;&#8221;);<br />
// search for color<br />
for (i=0; i&lt;pairs.length; i++)<br />
if (pairs[i].search(&#8220;color&#8221;)!=-1) break;<br />
if (i==pairs.length) // no color..<br />
return new Array(0,0,0);<br />
// separate style from substance (!)<br />
value=pairs[i].split(&#8220;:&#8221;);<br />
// value[1] is rgb&#8230;<br />
col=value[1].slice(5,value[1].length-1);<br />
colours=col.split(&#8220;,&#8221;);<br />
return colours;<br />
}<br />
else // for IE, so c is like &#8216;rgb(12,3,4)<br />
{<br />
if (c==&#8221;") // no color defined<br />
return new Array(0,0,0);<br />
col=c.slice(4,c.length-1); // slice from rgb(&#8230;<br />
// split 3 parts on ,<br />
colours=col.split(&#8220;,&#8221;);<br />
return colours;<br />
}</p>
<p>}</p>
<p>This works on FireFox, Opera and IE &#8211; maybe others</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waltermilner.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waltermilner.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waltermilner.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waltermilner.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waltermilner.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waltermilner.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waltermilner.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waltermilner.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waltermilner.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waltermilner.wordpress.com/196/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=196&subd=waltermilner&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waltermilner.wordpress.com/2009/08/30/javascript-and-oop-for-the-dom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9d1cd29e1482533ded586b3a66c70ac0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waltermilner</media:title>
		</media:content>
	</item>
		<item>
		<title>OOP in Javascript</title>
		<link>http://waltermilner.wordpress.com/2009/08/29/oop-in-javascript/</link>
		<comments>http://waltermilner.wordpress.com/2009/08/29/oop-in-javascript/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 12:47:43 +0000</pubDate>
		<dc:creator>waltermilner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://waltermilner.wordpress.com/?p=194</guid>
		<description><![CDATA[So it is possible to do a kind of OOP in JavaScript. For example, here is a complex number class (prototype), with private data fields:
function Complex(r,i)
{
var real=r;
var imag=i;
this.add = function(other)
{
result = new Complex(0,0);
result.setR(real+other.getR());
result.setI(imag+other.getI());
return result;
}
this.display = function()
{
alert(real+&#8221;+&#8221;+imag+&#8221;i&#8221;);
}
this.getR = function() {
return real;
}
this.getI = function() {
return imag;
}
this.setR = function(v) {
real=v;
}
this.setI = function(s) {
imag=s;
}
}
function start()
{
numb1 = new Complex(1,2);
numb2 = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=194&subd=waltermilner&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>So it is possible to do a kind of OOP in JavaScript. For example, here is a complex number class (prototype), with private data fields:</p>
<p>function Complex(r,i)<br />
{<br />
var real=r;<br />
var imag=i;</p>
<p>this.add = function(other)<br />
{<br />
result = new Complex(0,0);<br />
result.setR(real+other.getR());<br />
result.setI(imag+other.getI());<br />
return result;<br />
}</p>
<p>this.display = function()<br />
{<br />
alert(real+&#8221;+&#8221;+imag+&#8221;i&#8221;);<br />
}</p>
<p>this.getR = function() {<br />
return real;<br />
}<br />
this.getI = function() {<br />
return imag;<br />
}<br />
this.setR = function(v) {<br />
real=v;<br />
}<br />
this.setI = function(s) {<br />
imag=s;<br />
}<br />
}</p>
<p>function start()<br />
{<br />
numb1 = new Complex(1,2);<br />
numb2 = new Complex(3,4);<br />
numb3 = numb1.add(numb2);<br />
numb3.display();<br />
return;<br />
}</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waltermilner.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waltermilner.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waltermilner.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waltermilner.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waltermilner.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waltermilner.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waltermilner.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waltermilner.wordpress.com/194/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waltermilner.wordpress.com/194/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waltermilner.wordpress.com/194/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=194&subd=waltermilner&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waltermilner.wordpress.com/2009/08/29/oop-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9d1cd29e1482533ded586b3a66c70ac0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waltermilner</media:title>
		</media:content>
	</item>
		<item>
		<title>OO in CSS</title>
		<link>http://waltermilner.wordpress.com/2009/08/28/oo-in-css/</link>
		<comments>http://waltermilner.wordpress.com/2009/08/28/oo-in-css/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 18:18:55 +0000</pubDate>
		<dc:creator>waltermilner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://waltermilner.wordpress.com/?p=192</guid>
		<description><![CDATA[I&#8217;ve just coded something in Javascript which fades the color of an element from blue to red when you mouseover, and red back to blue when you mouseout. Then in the HTML you give the element the attribute onmouseover = &#8216;whatever
But suppose, in the spirit of CSS, I want to make this happen for each [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=192&subd=waltermilner&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve just coded something in Javascript which fades the color of an element from blue to red when you mouseover, and red back to blue when you mouseout. Then in the HTML you give the element the attribute onmouseover = &#8216;whatever</p>
<p>But suppose, in the spirit of CSS, I want to make this happen for each instance of that selector (or class). In other words in CSS I want to specify the dynamic behaviour, as well as static appearance properties, of whatever it is. In other words I want to be able to treat CSS selector items as OOP classes. But I can&#8217;t (can I?) Come on, W3C, get it sorted.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waltermilner.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waltermilner.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waltermilner.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waltermilner.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waltermilner.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waltermilner.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waltermilner.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waltermilner.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waltermilner.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waltermilner.wordpress.com/192/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=192&subd=waltermilner&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waltermilner.wordpress.com/2009/08/28/oo-in-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9d1cd29e1482533ded586b3a66c70ac0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waltermilner</media:title>
		</media:content>
	</item>
		<item>
		<title>Chromed text with the GIMP</title>
		<link>http://waltermilner.wordpress.com/2009/08/26/chromed-text-with-the-gimp/</link>
		<comments>http://waltermilner.wordpress.com/2009/08/26/chromed-text-with-the-gimp/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 07:58:06 +0000</pubDate>
		<dc:creator>waltermilner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[GIMP]]></category>
		<category><![CDATA[graphics]]></category>

		<guid isPermaLink="false">http://waltermilner.wordpress.com/?p=181</guid>
		<description><![CDATA[Chrome Text For GIMP 2.6.7 &#8211; thanks to Penguin Pete
1. Write your text, in white on a black background

2. Blur it a bit by Filters..Blur.. Gaussian blur.. 5 pixels: (This is for the bump map we make later)

3.Do Select..By color, then click on the black. Then Select Invert. This gives a selection around the text:

4. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=181&subd=waltermilner&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Chrome Text For GIMP 2.6.7 &#8211; thanks to Penguin Pete</p>
<p>1. Write your text, in white on a black background</p>
<p><img class="aligncenter size-full wp-image-183" title="pic1" src="http://waltermilner.files.wordpress.com/2009/08/pic11.jpg?w=469&#038;h=373" alt="pic1" width="469" height="373" /></p>
<p>2. Blur it a bit by Filters..Blur.. Gaussian blur.. 5 pixels: (This is for the bump map we make later)</p>
<p><img class="aligncenter size-full wp-image-184" title="pic2" src="http://waltermilner.files.wordpress.com/2009/08/pic2.png?w=469&#038;h=373" alt="pic2" width="469" height="373" /></p>
<p>3.Do Select..By color, then click on the black. Then Select Invert. This gives a selection around the text:</p>
<p><img class="aligncenter size-full wp-image-185" title="pic3" src="http://waltermilner.files.wordpress.com/2009/08/pic3.png?w=469&#038;h=373" alt="pic3" width="469" height="373" /></p>
<p>4. Add a new transparent layer, select it and hide the rest. Do a gradient blend, using black to white:</p>
<p><img class="aligncenter size-full wp-image-186" title="pic4" src="http://waltermilner.files.wordpress.com/2009/08/pic4.png?w=469&#038;h=373" alt="pic4" width="469" height="373" /></p>
<p>5. Bump map &#8211; Go Filters..Map.. Bump Map. Use the black and white layer as the bump map:</p>
<p><img class="aligncenter size-full wp-image-187" title="pic5" src="http://waltermilner.files.wordpress.com/2009/08/pic5.png?w=469&#038;h=373" alt="pic5" width="469" height="373" /></p>
<p>6. Go Colors..Curves, and use a curve on value somethink like this:</p>
<p><img class="aligncenter size-full wp-image-188" title="pic6" src="http://waltermilner.files.wordpress.com/2009/08/pic6.png?w=378&#038;h=528" alt="pic6" width="378" height="528" /></p>
<p>The result:</p>
<p><img class="aligncenter size-full wp-image-189" title="pic7" src="http://waltermilner.files.wordpress.com/2009/08/pic7.png?w=469&#038;h=373" alt="pic7" width="469" height="373" /></p>
<p>Chromed button by similar process:</p>
<p><img class="aligncenter size-full wp-image-190" title="pic8" src="http://waltermilner.files.wordpress.com/2009/08/pic8.png?w=469&#038;h=373" alt="pic8" width="469" height="373" /></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waltermilner.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waltermilner.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waltermilner.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waltermilner.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waltermilner.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waltermilner.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waltermilner.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waltermilner.wordpress.com/181/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waltermilner.wordpress.com/181/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waltermilner.wordpress.com/181/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=181&subd=waltermilner&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waltermilner.wordpress.com/2009/08/26/chromed-text-with-the-gimp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9d1cd29e1482533ded586b3a66c70ac0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waltermilner</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/08/pic11.jpg" medium="image">
			<media:title type="html">pic1</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/08/pic2.png" medium="image">
			<media:title type="html">pic2</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/08/pic3.png" medium="image">
			<media:title type="html">pic3</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/08/pic4.png" medium="image">
			<media:title type="html">pic4</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/08/pic5.png" medium="image">
			<media:title type="html">pic5</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/08/pic6.png" medium="image">
			<media:title type="html">pic6</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/08/pic7.png" medium="image">
			<media:title type="html">pic7</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/08/pic8.png" medium="image">
			<media:title type="html">pic8</media:title>
		</media:content>
	</item>
		<item>
		<title>The GreekLetterWidget</title>
		<link>http://waltermilner.wordpress.com/2009/06/17/the-greekletterwidget/</link>
		<comments>http://waltermilner.wordpress.com/2009/06/17/the-greekletterwidget/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 08:09:21 +0000</pubDate>
		<dc:creator>waltermilner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Greek letters]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Swing]]></category>
		<category><![CDATA[UIWidgets]]></category>
		<category><![CDATA[Unicode]]></category>

		<guid isPermaLink="false">http://waltermilner.wordpress.com/?p=175</guid>
		<description><![CDATA[I&#8217;m currently writing some maths software in which I wanted to be able to use Greek letters as well as Roman. Since Java uses Unicode, this was no problem internally. But how could the user input Greek as well as Roman characters, through a standard US/UK keyboard, and without obscure and slow character codes?
So I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=175&subd=waltermilner&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m currently writing some maths software in which I wanted to be able to use Greek letters as well as Roman. Since Java uses Unicode, this was no problem internally. But how could the user input Greek as well as Roman characters, through a standard US/UK keyboard, and without obscure and slow character codes?</p>
<p>So I wrote a widget which had 25 buttons, labelled with the lower case Greek letters. It has an instance variable which is a reference to a textfield. When the user clicks a button, the corresponding character is appended to that textfield, and focus is placed on that textfield, ready for the next keystroke.</p>
<p>Here it is:</p>
<h6>/**<br />
 * This is a UI widget supporting the input of Greek letters<br />
 * It produces a 5 X 5 grid of buttons, labelled with lower case Greek letters<br />
 * When a button is clicked, the corresponding letter is appended to a supplied<br />
 * text field<br />
 * @author Walter Milner<br />
 */<br />
public class GreekLetterWidget extends JComponent implements ActionListener {</h6>
<h6>    private MyButton[] buttons = new MyButton[25];<br />
    private MyTextField textField;<br />
/**<br />
 * make an instance, of size 100 by 100<br />
 * @param textField The textfield to which the letter will be appended<br />
 */<br />
    public GreekLetterWidget(MyTextField textField) {<br />
        this.textField = textField;<br />
        setLayout(new GridLayout(5, 5));<br />
        setSize(100, 100);<br />
        // Greek letter buttons<br />
        char[] c = new char[1];<br />
        c[0] = &#8216;\u03B1&#8242;;<br />
        String s = new String(c);<br />
        Insets inset = new Insets(1, 1, 1, 1);<br />
        for (int i = 0; i &lt; 25; i++) {<br />
            buttons[i] = new MyButton(s);<br />
            buttons[i].setToolTipText(s);<br />
            c[0]++;<br />
            s = new String(c);<br />
            buttons[i].setMargin(inset);<br />
            buttons[i].addActionListener(this);<br />
            add(buttons[i]);<br />
        }</h6>
<h6>    }<br />
    public void setField(MyTextField target)<br />
    {<br />
        textField=target;<br />
    }</h6>
<h6>    public void actionPerformed(ActionEvent e) {<br />
        Object obj = e.getSource();<br />
        textField.setText(textField.getText() + ((MyButton) obj).getText());<br />
        textField.requestFocus();<br />
    }<br />
}</h6>
<p>This looks like:</p>
<div id="attachment_178" class="wp-caption alignleft" style="width: 427px"><img class="size-full wp-image-178" title="pic2" src="http://waltermilner.files.wordpress.com/2009/06/pic2.jpg?w=417&#038;h=321" alt="screenshot" width="417" height="321" /><p class="wp-caption-text">screenshot</p></div>
<div class="mceTemp">The widget is used (in a sub-classed JDialog using a GridBagLayout) with code like this</div>
<h6 class="mceTemp">glw = new GreekLetterWidget(funcTextField);<br />
c.gridx = 3;</h6>
<h6 class="mceTemp">c.gridy = 0;<br />
c.gridheight = 2;<br />
add(glw, c);</h6>
<p class="mceTemp">The setTextField() method is provided so that this can be used with more than one text field in a dialog. The textfields need to have a focuslistener, and in the gainFocus, setTextField is called with that text field as the parameter. That means that when the user clicks on a textfield, from then on GreekLetter button clicks go into that text field.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waltermilner.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waltermilner.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waltermilner.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waltermilner.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waltermilner.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waltermilner.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waltermilner.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waltermilner.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waltermilner.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waltermilner.wordpress.com/175/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=175&subd=waltermilner&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waltermilner.wordpress.com/2009/06/17/the-greekletterwidget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9d1cd29e1482533ded586b3a66c70ac0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waltermilner</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/06/pic2.jpg" medium="image">
			<media:title type="html">pic2</media:title>
		</media:content>
	</item>
		<item>
		<title>Padding a JLabel</title>
		<link>http://waltermilner.wordpress.com/2009/06/17/padding-a-jlabel/</link>
		<comments>http://waltermilner.wordpress.com/2009/06/17/padding-a-jlabel/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 07:44:10 +0000</pubDate>
		<dc:creator>waltermilner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Border]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JLabel]]></category>
		<category><![CDATA[padding]]></category>
		<category><![CDATA[Swing]]></category>

		<guid isPermaLink="false">http://waltermilner.wordpress.com/?p=170</guid>
		<description><![CDATA[Googling for this was pretty fruitless, but I eventually got a hint, which worked out OK. The hack is to have an &#8216;empty&#8217; border around the text. If you also want a visible border, you can combine that with the empty border in a compound border. So you have something like:
public class MyLabel extends JLabel {
    [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=170&subd=waltermilner&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Googling for this was pretty fruitless, but I eventually got a hint, which worked out OK. The hack is to have an &#8216;empty&#8217; border around the text. If you also want a visible border, you can combine that with the empty border in a compound border. So you have something like:</p>
<h6>public class MyLabel extends JLabel {<br />
    static Font labelFont = new Font(&#8220;SansSerif&#8221;, Font.PLAIN, 12);<br />
    static Border gap = BorderFactory.createEmptyBorder(4, 2, 4, 2);<br />
    static Border blueline = BorderFactory.createLineBorder(Color.blue);<br />
    static Border compound = BorderFactory.createCompoundBorder(blueline, gap);<br />
    MyLabel(String text) {<br />
        super(text);<br />
        setFont(labelFont);<br />
        setBorder(compound);<br />
    }<br />
}</h6>
<p>which looks like:</p>
<div id="attachment_171" class="wp-caption alignleft" style="width: 287px"><img class="size-full wp-image-171" title="pic" src="http://waltermilner.files.wordpress.com/2009/06/pic.jpg?w=277&#038;h=93" alt="screenshot" width="277" height="93" /><p class="wp-caption-text">screenshot</p></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waltermilner.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waltermilner.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waltermilner.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waltermilner.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waltermilner.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waltermilner.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waltermilner.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waltermilner.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waltermilner.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waltermilner.wordpress.com/170/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=170&subd=waltermilner&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waltermilner.wordpress.com/2009/06/17/padding-a-jlabel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9d1cd29e1482533ded586b3a66c70ac0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waltermilner</media:title>
		</media:content>

		<media:content url="http://waltermilner.files.wordpress.com/2009/06/pic.jpg" medium="image">
			<media:title type="html">pic</media:title>
		</media:content>
	</item>
		<item>
		<title>Fodor&#8217;s Concepts &#8211; Where Cognitive Science Went Wrong</title>
		<link>http://waltermilner.wordpress.com/2009/06/02/fodors-concepts-where-cognitive-science-went-wrong/</link>
		<comments>http://waltermilner.wordpress.com/2009/06/02/fodors-concepts-where-cognitive-science-went-wrong/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 11:02:03 +0000</pubDate>
		<dc:creator>waltermilner</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://waltermilner.wordpress.com/?p=168</guid>
		<description><![CDATA[Jerry Fodor, semantics, concepts, meaning<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=168&subd=waltermilner&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m into the first chapter, then I had to go back to the &#8216;Typological Conventions&#8217; at the start. And I found that these were not straight-forward. Here is a version:</p>
<p>Rule 1: Names of concepts are written in capitals</p>
<p>Rule 2: Names of English expressions appear in single quotes.</p>
<p>Rule 3: Names of semantic values of words and concepts are written in italics.</p>
<p>At a glance, this is clear. But if you think carefully, it entails a great deal &#8211; possibly the whole book. To start with, it refers to names. Do these kinds of things have names? For example, does the English phrase &#8216;red&#8217; have a name? If so, what is it? Is it the word red?</p>
<p>What is a name? In terms of how the term is used (hence a Wittgensteinian approach), names are used where there are a set of similar things, and names arbitrarily label and distinguish them. For example, &#8216;What is the name of this mountain?&#8217;, &#8216;What is the name of this river?&#8217;, &#8216;What is your name?&#8217; and so on. Otherwise, things don&#8217;t have names. Or you could ask &#8216;What is the name of your name?&#8217;  Since your name is (more or less) unique, it does not need a name to distinguish it from other names.</p>
<p>I think here &#8216;name&#8217; is used as in &#8216;is expressed by&#8217;. Then we would have a modified version</p>
<p>1. Concepts are expressed by text written in capitals.</p>
<p>2. Phrases are expressed by text in quotes.</p>
<p>3. Semantic values of words and concepts are expressed in italics.</p>
<p>However the third rule also entails the assertion that word phrases and concepts have &#8217;semantic values&#8217;.  So this would be more explicit as follows:</p>
<p>1. Words and concepts both have associated semantic values</p>
<p>2. Semantic values are expressed in italics</p>
<p>3. Concepts are expressed in capitals</p>
<p>4. Word phrases are expressed in quotes ( to distinguish them from surrounding text which discusses the word phrases).</p>
<p>Then, for example, the concept RED and the word &#8216;red&#8217; both have the semantic value <em>being red</em>.</p>
<p>But that asserts that words and concepts mean things, and it seems that if a word phrase and a concept mean the same thing, the concept is redundant, and we only need to discuss the word phrase and its meaning. But I suppose that would beg the question of why some phrases, like &#8216;Colorless green ideas&#8217;, do not have meanings.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waltermilner.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waltermilner.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waltermilner.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waltermilner.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waltermilner.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waltermilner.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waltermilner.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waltermilner.wordpress.com/168/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waltermilner.wordpress.com/168/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waltermilner.wordpress.com/168/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waltermilner.wordpress.com&blog=464072&post=168&subd=waltermilner&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waltermilner.wordpress.com/2009/06/02/fodors-concepts-where-cognitive-science-went-wrong/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9d1cd29e1482533ded586b3a66c70ac0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">waltermilner</media:title>
		</media:content>
	</item>
	</channel>
</rss>