<?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-5281523794451295866</id><updated>2012-02-16T14:05:59.995-08:00</updated><category term='js'/><category term='swing'/><title type='text'>Java Blogs</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://lantotjavablog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://lantotjavablog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>allanjb</name><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>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5281523794451295866.post-5098229391166651103</id><published>2007-11-13T06:43:00.000-08:00</published><updated>2007-11-13T07:02:38.384-08:00</updated><title type='text'>Heap size: java.lang.OutOfMemoryError</title><content type='html'>To avoid java.lang.OutOfMemoryError when dealing with swing programming or IO files with large size, just tune the heap size or your java virtual machine:&lt;br /&gt;&lt;br /&gt;Syntax:&lt;br /&gt;&lt;pre&gt;java -Xms&lt;initial&gt;_initial heap size_ -Xmx_max heap size_&lt;max&gt;&lt;/max&gt;&lt;/initial&gt;&lt;/pre&gt;Default:&lt;br /&gt;&lt;pre&gt;java -Xms32m -Xmx128m&lt;/pre&gt;In my case, I increased it to 512MB such as&lt;br /&gt;&lt;pre&gt;java -Xms32m -Xmx512m&lt;/pre&gt;&lt;br /&gt;Resources:&lt;br /&gt;[1]  &lt;a href="http://edocs.bea.com/wls/docs61/perform/JVMTuning.html"&gt;http://edocs.bea.com/wls/docs61/perform/JVMTuning.html &lt;/a&gt;&lt;br /&gt;[2]  &lt;a href="http://hausheer.osola.com/docs/5"&gt;http://hausheer.osola.com/docs/5&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5281523794451295866-5098229391166651103?l=lantotjavablog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lantotjavablog.blogspot.com/feeds/5098229391166651103/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5281523794451295866&amp;postID=5098229391166651103' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/5098229391166651103'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/5098229391166651103'/><link rel='alternate' type='text/html' href='http://lantotjavablog.blogspot.com/2007/11/heap-size-javalangoutofmemoryerror.html' title='Heap size: java.lang.OutOfMemoryError'/><author><name>allanjb</name><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-5281523794451295866.post-3252464803172575637</id><published>2007-10-11T17:34:00.000-07:00</published><updated>2007-10-11T17:43:03.449-07:00</updated><title type='text'>Good usage of anonymous inner class</title><content type='html'>I just found out a good usage of anonymous inner class. Code shown below is an alternative of creating an AbstractTableModel that sets the table editable mode to off.&lt;br /&gt;&lt;blockquote&gt;JTable table = new JTable(){&lt;br /&gt;   public boolean isEditable(){&lt;br /&gt;      return true;&lt;br /&gt;   }&lt;br /&gt;}&lt;/blockquote&gt;The result is clean code plus I can set the table's model to DefaultTableModel with uneditable table cell mode.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5281523794451295866-3252464803172575637?l=lantotjavablog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lantotjavablog.blogspot.com/feeds/3252464803172575637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5281523794451295866&amp;postID=3252464803172575637' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/3252464803172575637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/3252464803172575637'/><link rel='alternate' type='text/html' href='http://lantotjavablog.blogspot.com/2007/10/good-usage-of-anonymous-inner-class.html' title='Good usage of anonymous inner class'/><author><name>allanjb</name><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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281523794451295866.post-1363509436841648741</id><published>2007-10-09T07:12:00.000-07:00</published><updated>2007-10-09T07:14:02.246-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swing'/><title type='text'>Problem on ImageIcon when path is a URL</title><content type='html'>I am still figuring out how to add remote icon for a swing component given the URL path of the image. The constructor new ImageIcon(URL) is not working.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5281523794451295866-1363509436841648741?l=lantotjavablog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lantotjavablog.blogspot.com/feeds/1363509436841648741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5281523794451295866&amp;postID=1363509436841648741' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/1363509436841648741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/1363509436841648741'/><link rel='alternate' type='text/html' href='http://lantotjavablog.blogspot.com/2007/10/problem-on-imageicon-when-path-is-url.html' title='Problem on ImageIcon when path is a URL'/><author><name>allanjb</name><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>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5281523794451295866.post-9144562319881134146</id><published>2007-10-08T22:44:00.000-07:00</published><updated>2007-10-08T23:34:54.267-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='js'/><title type='text'>Javascript sample</title><content type='html'>This blog post exhibits jquery usage to toggle appearance of a phrase.&lt;br /&gt;&lt;script src="http://allan.the.thinker.googlepages.com/jquery.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;span class='clicker'&gt;Click here&lt;/span&gt;&lt;br /&gt;&lt;span class='slide'&gt;Allan here doing js.&lt;/p&gt;&lt;br /&gt;&lt;script&gt;$("span.clicker").click( function () { $("span.slide").slideToggle(); });&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5281523794451295866-9144562319881134146?l=lantotjavablog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lantotjavablog.blogspot.com/feeds/9144562319881134146/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5281523794451295866&amp;postID=9144562319881134146' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/9144562319881134146'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/9144562319881134146'/><link rel='alternate' type='text/html' href='http://lantotjavablog.blogspot.com/2007/10/javascript-sample.html' title='Javascript sample'/><author><name>allanjb</name><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-5281523794451295866.post-5970932563499976663</id><published>2007-10-01T02:06:00.000-07:00</published><updated>2007-10-01T02:43:01.159-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='swing'/><title type='text'>Proper execution of Java Swing</title><content type='html'>Swing event-handling and painting code executes in a single thread, called the  &lt;em&gt;event-dispatching thread&lt;/em&gt;. This ensures that each event handler finishes  executing before the next one executes and that painting isn't interrupted by  events. To avoid the possibility of deadlock, you must take extreme care that  Swing components and models are created, modified, and queried &lt;em&gt;only&lt;/em&gt;  from the event-dispatching thread.&lt;br /&gt;&lt;br /&gt;   Using &lt;span style="font-family:courier new;"&gt;SwingUtilities.invokeLater&lt;/span&gt; to ensure that the code executes on a special thread.&lt;br /&gt;   Threads -  lightweight processes that can run concurrently.&lt;br /&gt;&lt;br /&gt;The &lt;span style="font-family:courier new;"&gt;invokeLater &lt;/span&gt;method returns immediately, without waiting for the event-dispatching thread to execute the code. This inhibits the deadlock that maybe caused by updating and repainting of GUI component.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Example:&lt;/span&gt;&lt;br /&gt;&lt;blockquote style="font-family: courier new;"&gt;SwingUtilities.invokeLater(new Runnable() {&lt;br /&gt;      public void run() {&lt;br /&gt;          MyJFrame f = new MyJFrame();&lt;br /&gt;// set center location&lt;br /&gt;          f.setLocationRelativeTo(null);&lt;br /&gt;// show GUI&lt;br /&gt;          f.setVisible(true);&lt;br /&gt;      }&lt;br /&gt;  });&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5281523794451295866-5970932563499976663?l=lantotjavablog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lantotjavablog.blogspot.com/feeds/5970932563499976663/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5281523794451295866&amp;postID=5970932563499976663' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/5970932563499976663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/5970932563499976663'/><link rel='alternate' type='text/html' href='http://lantotjavablog.blogspot.com/2007/10/proper-execution-of-java-swing.html' title='Proper execution of Java Swing'/><author><name>allanjb</name><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-5281523794451295866.post-7284042585718727689</id><published>2007-10-01T01:52:00.000-07:00</published><updated>2007-10-01T02:11:41.091-07:00</updated><title type='text'>Hacking Blogspot</title><content type='html'>&lt;script&gt;document.writeln('Some of this days, a pretty UI will be posted with desktop functionalities.&lt;br/&gt;Also it is possible to create a function that colorizes Java syntax just like what Wordpress did.');&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5281523794451295866-7284042585718727689?l=lantotjavablog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lantotjavablog.blogspot.com/feeds/7284042585718727689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5281523794451295866&amp;postID=7284042585718727689' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/7284042585718727689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/7284042585718727689'/><link rel='alternate' type='text/html' href='http://lantotjavablog.blogspot.com/2007/10/alertwelcome.html' title='Hacking Blogspot'/><author><name>allanjb</name><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-5281523794451295866.post-5059980295045926392</id><published>2007-09-29T22:17:00.001-07:00</published><updated>2007-09-29T22:25:14.311-07:00</updated><title type='text'>Project ChickenFoot using Java</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Concept:&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Login to friendster and post blog in just 1 click.&lt;/li&gt;&lt;li&gt;The application behaves like &lt;a href="http://groups.csail.mit.edu/uid/chickenfoot/"&gt;chickenfoot&lt;/a&gt;.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Java application will be a frame with textarea for blog message and a Post button.&lt;/li&gt;&lt;li&gt;When post button is clicked, a login frame will appear. After supplying login detail, the application will post the message to friendster blogs.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;This uses HtmlUnit as html loader and parser.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5281523794451295866-5059980295045926392?l=lantotjavablog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lantotjavablog.blogspot.com/feeds/5059980295045926392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5281523794451295866&amp;postID=5059980295045926392' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/5059980295045926392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/5059980295045926392'/><link rel='alternate' type='text/html' href='http://lantotjavablog.blogspot.com/2007/09/project-chickenfoot-using-java.html' title='Project ChickenFoot using Java'/><author><name>allanjb</name><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-5281523794451295866.post-6573619225778302722</id><published>2007-09-29T21:32:00.001-07:00</published><updated>2007-09-29T21:39:28.339-07:00</updated><title type='text'>Retrieve IP</title><content type='html'>Sample code for retrieving IP or hostname from given url:&lt;br /&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;span style="font-family:courier new;"&gt;import java.net.InetAddress;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;import java.net.UnknownHostException;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;public class RetrieveIP {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    public static void main(String[] args) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        String site = "www.yahoo.com";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        InetAddress ad = null;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        try {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;            ad = InetAddress.getByName(site);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        } catch (UnknownHostException e) {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;            e.printStackTrace();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        }// try-catch&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;        System.out.println(ad);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    }// main&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;}// class&lt;br /&gt;&lt;br /&gt;// www.yahoo.com/209.131.36.158&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5281523794451295866-6573619225778302722?l=lantotjavablog.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://lantotjavablog.blogspot.com/feeds/6573619225778302722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5281523794451295866&amp;postID=6573619225778302722' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/6573619225778302722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5281523794451295866/posts/default/6573619225778302722'/><link rel='alternate' type='text/html' href='http://lantotjavablog.blogspot.com/2007/09/sample-code-for-retrieving-ip-or.html' title='Retrieve IP'/><author><name>allanjb</name><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>
