<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-21127505</id><updated>2011-04-21T14:21:17.254-07:00</updated><title type='text'>Bohemian Code</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://bohemianflux.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21127505/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://bohemianflux.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Sumeet Parmar</name><uri>http://www.blogger.com/profile/16324669536365131017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-21127505.post-114357116186516202</id><published>2006-03-28T10:34:00.000-08:00</published><updated>2006-03-28T10:55:11.140-08:00</updated><title type='text'>Generics tutorial</title><content type='html'>Found this fantastic introduction to generics and many cool code snippets by &lt;i&gt;Gilad Bracha&lt;/i&gt;. The wildcard chapter is worth the trip. Enjoy.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf"&gt; Generics Tutorial (pdf)&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21127505-114357116186516202?l=bohemianflux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bohemianflux.blogspot.com/feeds/114357116186516202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21127505&amp;postID=114357116186516202' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21127505/posts/default/114357116186516202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21127505/posts/default/114357116186516202'/><link rel='alternate' type='text/html' href='http://bohemianflux.blogspot.com/2006/03/generics-tutorial.html' title='Generics tutorial'/><author><name>Sumeet Parmar</name><uri>http://www.blogger.com/profile/16324669536365131017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21127505.post-113813155371283601</id><published>2006-01-24T11:22:00.000-08:00</published><updated>2006-01-24T14:09:34.106-08:00</updated><title type='text'>Running Ant on Mac OS X with JDK 1.5</title><content type='html'>For Mac OS X's Java 1.5, the Java preferences utility allows switching versions for applets and applications launched from jars (java -jar) or JNLP (Web Start). This is described in this release note: &lt;a href="http://developer.apple.com/releasenotes/Java/Java50Release3RN/index.html"&gt;Apple Java 1.5 Release Note&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;However on the command line, ant doesn't pick up the version change even after following the tech note. The release note recommends adding $JAVA_HOME/Commands to the PATH. For Ant, it doesn't work because the ant startup script looks for 'java' in $JAVA_HOME/bin and &lt;b&gt;that&lt;/b&gt;, dear friends, does not exist in the standard installation. This is easily solved:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;br /&gt;&lt;p class="codeblock"&gt;&lt;br /&gt;(in .bashrc or equivalent)&lt;br /&gt;export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5&lt;br /&gt;&lt;br /&gt;(as su)&lt;br /&gt;cd $JAVA_HOME&lt;br /&gt;ln -s Commands bin&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That's all to it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21127505-113813155371283601?l=bohemianflux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bohemianflux.blogspot.com/feeds/113813155371283601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21127505&amp;postID=113813155371283601' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21127505/posts/default/113813155371283601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21127505/posts/default/113813155371283601'/><link rel='alternate' type='text/html' href='http://bohemianflux.blogspot.com/2006/01/running-ant-on-mac-os-x-with-jdk-15.html' title='Running Ant on Mac OS X with JDK 1.5'/><author><name>Sumeet Parmar</name><uri>http://www.blogger.com/profile/16324669536365131017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21127505.post-113797136824742238</id><published>2006-01-22T14:56:00.000-08:00</published><updated>2006-01-24T14:14:14.866-08:00</updated><title type='text'>Prototyping with ActionListener</title><content type='html'>When prototyping UIs in Swing I like to use ActionListener and a Hashtable to communicate inputs from a field to whatever needs to respond to it. Say there is a round rectangle such as:&lt;br /&gt;&lt;span&gt;&lt;br /&gt;&lt;p class="codeblock"&gt;&lt;br /&gt;int arcw = 8;&lt;br /&gt;int arch = 8;&lt;br /&gt;&lt;br /&gt;Shape shape =&lt;br /&gt;  new RoundRectangle2D.Double((double) x, (double) y, (double) w,&lt;br /&gt;                              (double) h, (double)arcw, (double)arch);&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Often with prototyping, one likes to fool around to look at various ways the UI may look. But instead of edit-recompile-test, throw in some text fields, add an ActionListener and play with it until cows come home. Like so:&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;br /&gt;&lt;p class="codeblock"&gt;class Pumper implements ActionListener {&lt;br /&gt;protected Hashtable propMap = null;&lt;br /&gt;protected String name = null;&lt;br /&gt;&lt;br /&gt;public Pumper(Hashtable propMap, String name) {&lt;br /&gt;this.propMap = propMap;&lt;br /&gt;this.name = name;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void actionPerformed(ActionEvent e) {&lt;br /&gt;propMap.put(name, ((JTextField) e.getSource()).getText());&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The propMap is a class field and the paint code may be modified like so:&lt;br /&gt;&lt;span&gt;&lt;p class="codeblock"&gt;// don't forget to initialize propMap with default "arcw" etc values!&lt;br /&gt;int arcw = Integer.parseInt(((String) propMap.get("arcw")));&lt;br /&gt;int arch = Integer.parseInt(((String) propMap.get("arch")));&lt;br /&gt;&lt;br /&gt;Shape shape =&lt;br /&gt;new RoundRectangle2D.Double((double) x, (double) y, (double) w,&lt;br /&gt;(double) h, (double)arcw, (double)arch);&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;and the textfield like so:&lt;br /&gt;&lt;span&gt;&lt;p class="codeblock"&gt; JTextField arcwTF = new JTextField(3);&lt;br /&gt;arcwTF.addActionListener(new Pumper(propMap, "arcw"));&lt;br /&gt;b2.add(new JLabel("arc width:"));&lt;br /&gt;b2.add(arcwTF);&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;That's it! Add a line code somewhere to invoke revalidate() or do what I do, resize the JFrame/JDialog a tad bit back and forth.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21127505-113797136824742238?l=bohemianflux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bohemianflux.blogspot.com/feeds/113797136824742238/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21127505&amp;postID=113797136824742238' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21127505/posts/default/113797136824742238'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21127505/posts/default/113797136824742238'/><link rel='alternate' type='text/html' href='http://bohemianflux.blogspot.com/2006/01/prototyping-with-actionlistener.html' title='Prototyping with ActionListener'/><author><name>Sumeet Parmar</name><uri>http://www.blogger.com/profile/16324669536365131017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-21127505.post-113755467586249572</id><published>2006-01-17T19:21:00.000-08:00</published><updated>2006-01-17T21:43:36.616-08:00</updated><title type='text'>void main (String [] args)</title><content type='html'>I like code. I like what it does. I like code with least issues and maximum potential. The author will attempt to do least amount of "I this-n-that" and most amount of "the code this-n-that". Keep coding.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/21127505-113755467586249572?l=bohemianflux.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bohemianflux.blogspot.com/feeds/113755467586249572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=21127505&amp;postID=113755467586249572' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/21127505/posts/default/113755467586249572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/21127505/posts/default/113755467586249572'/><link rel='alternate' type='text/html' href='http://bohemianflux.blogspot.com/2006/01/void-main-string-args.html' title='void main (String [] args)'/><author><name>Sumeet Parmar</name><uri>http://www.blogger.com/profile/16324669536365131017</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
