<?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>Alberto Bustamante &#187; Java</title>
	<atom:link href="http://www.albertobustamante.com/blog/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.albertobustamante.com/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Fri, 21 May 2010 19:46:04 +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>JScrollPane, JTable and horizontal scroll</title>
		<link>http://www.albertobustamante.com/blog/2009/12/jscrollpane-jtable-and-horizontal-scroll/</link>
		<comments>http://www.albertobustamante.com/blog/2009/12/jscrollpane-jtable-and-horizontal-scroll/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 19:39:18 +0000</pubDate>
		<dc:creator>Alberto</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[jscrollpane]]></category>
		<category><![CDATA[jtable]]></category>
		<category><![CDATA[swing]]></category>

		<guid isPermaLink="false">http://www.albertobustamante.com/blog/?p=119</guid>
		<description><![CDATA[I was coding a graphical interface using Java, and what I wanted was to insert a JTable object inside a JScrollPane. The table was bigger than the JScrollPane, but I didnt know why, only the vertical scroll bar was shown. I spent hours reading Swing tutorials, checking my code&#8230; everything seemed to be ok, so.. [...]]]></description>
			<content:encoded><![CDATA[<p>I was coding a graphical interface using Java, and what I wanted was to insert a JTable object inside a JScrollPane. The table was bigger than the JScrollPane, but I didnt know why, only the vertical scroll bar was shown. I spent hours reading Swing tutorials, checking my code&#8230; everything seemed to be ok, so.. why it wasnt working?<br />
Finally, I found the answer: there is a bug in Java when you are using JScrollPane and JTable. And the solution was to create a new class extending JTable, in order to override JTable.getScrollableTracksViewportWidth() method with this one:</p>
<blockquote><p class="code">public boolean getScrollableTracksViewportWidth() {</p>
<p class="code" style="padding-left: 30px;">if (autoResizeMode != AUTO_RESIZE_OFF) {</p>
<p class="code" style="padding-left: 60px;">if (getParent() instanceof JViewport) {</p>
<p class="code" style="padding-left: 90px;">return (((JViewport)getParent()).getWidth() &gt; getPreferredSize().width);</p>
<p class="code" style="padding-left: 60px;">}</p>
<p class="code" style="padding-left: 30px;">}</p>
<p class="code" style="padding-left: 30px;">return false;</p>
<p class="code">}</p>
</blockquote>
<p>Source: <a href="http://www.daniweb.com/forums/thread29263.html#">DaniWeb Forum</a></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.albertobustamante.com/blog/2009/06/the-class-javautilproperties/" rel="bookmark" class="crp_title">The Class java.util.Properties</a></li><li><a href="http://www.albertobustamante.com/blog/2010/05/automatic-recognition-of-sarcasm/" rel="bookmark" class="crp_title">Automatic recognition of sarcasm</a></li><li><a href="http://www.albertobustamante.com/blog/2009/12/fixing-wordpress-error-500/" rel="bookmark" class="crp_title">Fixing Wordpress Error 500</a></li><li><a href="http://www.albertobustamante.com/blog/2009/12/machine-learning-in-stanford-university/" rel="bookmark" class="crp_title">Machine Learning in Stanford University</a></li><li><a href="http://www.albertobustamante.com/blog/2009/11/compiling-erlang-on-mac/" rel="bookmark" class="crp_title">Compiling Erlang on Mac</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.albertobustamante.com/blog/2009/12/jscrollpane-jtable-and-horizontal-scroll/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Class java.util.Properties</title>
		<link>http://www.albertobustamante.com/blog/2009/06/the-class-javautilproperties/</link>
		<comments>http://www.albertobustamante.com/blog/2009/06/the-class-javautilproperties/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 21:36:58 +0000</pubDate>
		<dc:creator>Alberto</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Coding]]></category>

		<guid isPermaLink="false">http://www.albertobustamante.com/blog/?p=78</guid>
		<description><![CDATA[I didnt know this class before start using it some months ago. Now I love it because it makes easier the handling of properties in your Java code.

public class Properties extends Hashtable {
protected Properties defaults;
public Properties();
public Properties(Properties defaults);
public String getProperty(String key);
public String setProperty(String key, String defaultValue);
public Enumeration propertyNames();
public void load(InputStream in) throws IOException;
public void save(OutputStream [...]]]></description>
			<content:encoded><![CDATA[<p>I didnt know this class before start using it some months ago. Now I love it because it makes easier the handling of properties in your Java code.</p>
<blockquote><p>
public class Properties extends Hashtable {</p>
<p style="padding-left: 30px;">protected Properties <b>defaults</b>;<br />
public <b>Properties</b>();<br />
public <b>Properties</b>(Properties defaults);<br />
public String <b>getProperty</b>(String key);<br />
public String <b>setProperty</b>(String key, String defaultValue);<br />
public Enumeration <b>propertyNames</b>();<br />
public void <b>load</b>(InputStream in) throws IOException;<br />
public void <b>save</b>(OutputStream out, String header);<br />
public void <b>list</b>(PrintStream out);</p>
<p>}</p></blockquote>
<p>It extends java.util.HashTable, so this class stores each property as a pair of (key, value). If your application needs some parameters to work, you can include them in a file, and then, use a java.util.Properties object to load them.</p>
<blockquote><p>Properties props = new Properties();<br />
FileInputStream file = new FileInputStream(&#8220;propertiesfile.txt&#8221;);<br />
props.load(file)</p></blockquote>
<p>Using these three lines, you will have a java.util.Properties object filled with the content of &#8220;propertiesfile.txt&#8221;. But, whats the format of this file? It has to contain a pair  per line, and both of them have to be separated by a white space, &#8216;=&#8221; or &#8216;:&#8217;. The following file would be correct:</p>
<blockquote><p>Property1=Value1<br />
#This is a comment<br />
Property2:Value2<br />
Property3 Value3</p></blockquote>
<p>After loading this file, how can we access the properties? If we want to use the value of &#8220;Property1&#8243;:</p>
<blockquote><p>String value = getProperty(&#8220;Property1&#8243;);</p></blockquote>
<p>Or if we want to modify the value of &#8220;Property2&#8243;:</p>
<blockquote><p>setProperty(&#8220;Property2&#8243;,&#8221;New value&#8221;);</p></blockquote>
<p>More info: <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html">java.util.Properties</a></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://www.albertobustamante.com/blog/2009/12/jscrollpane-jtable-and-horizontal-scroll/" rel="bookmark" class="crp_title">JScrollPane, JTable and horizontal scroll</a></li><li><a href="http://www.albertobustamante.com/blog/2009/12/fixing-wordpress-error-500/" rel="bookmark" class="crp_title">Fixing Wordpress Error 500</a></li><li><a href="http://www.albertobustamante.com/blog/2009/05/fixing-wordpress-error-406/" rel="bookmark" class="crp_title">Fixing Wordpress Error 406</a></li><li><a href="http://www.albertobustamante.com/blog/2009/05/how-to-edit-path-variable-on-mac/" rel="bookmark" class="crp_title">How to edit PATH variable on Mac</a></li><li><a href="http://www.albertobustamante.com/blog/2009/11/solving-problems-with-subversion/" rel="bookmark" class="crp_title">Solving problems with Subversion</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://www.albertobustamante.com/blog/2009/06/the-class-javautilproperties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
