<?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, 03 Feb 2012 16:09:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<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/2011/10/gcc-gnu-compiler-collection/" rel="bookmark" class="crp_title">GCC, GNU compiler collection</a></li><li><a href="http://www.albertobustamante.com/blog/2011/01/random-sentences-your-first-wordpress-plugin/" rel="bookmark" class="crp_title">Random Sentences, your first WordPress plugin</a></li><li><a href="http://www.albertobustamante.com/blog/2011/03/support-free-and-open-source-software-community-as-a-candidate-for-the-prince-of-asturias-awards/" rel="bookmark" class="crp_title">Support Free and Open Source Software Community as a candidate for the Prince of Asturias Awards</a></li><li><a href="http://www.albertobustamante.com/blog/2012/02/makefile-commands-commence-before-first-target/" rel="bookmark" class="crp_title">Makefile: commands commence before first target</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(); [...]]]></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/2010/11/adding-repositories-on-ubuntu/" rel="bookmark" class="crp_title">Adding repositories on Ubuntu</a></li><li><a href="http://www.albertobustamante.com/blog/2010/11/solving-fake-checkouts-using-clearcase-and-eclipse/" rel="bookmark" class="crp_title">Solving fake checkouts using ClearCase and Eclipse</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/2011/01/random-sentences-your-first-wordpress-plugin/" rel="bookmark" class="crp_title">Random Sentences, your first WordPress plugin</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>

