<?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>Zeddic</title>
	<atom:link href="http://www.zeddic.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zeddic.com</link>
	<description>The Labs of Scott Bailey</description>
	<lastBuildDate>Wed, 02 Nov 2011 00:52:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Introduction to GWT UI Binders &amp; Templates</title>
		<link>http://www.zeddic.com/2011/11/introduction-to-gwt-ui-binders-templates/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=introduction-to-gwt-ui-binders-templates</link>
		<comments>http://www.zeddic.com/2011/11/introduction-to-gwt-ui-binders-templates/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 00:08:56 +0000</pubDate>
		<dc:creator>Scott Bailey</dc:creator>
				<category><![CDATA[Google Web Toolkit]]></category>

		<guid isPermaLink="false">http://www.zeddic.com/?p=205</guid>
		<description><![CDATA[As I touched on in a recent post about HTML document flow, I strongly believe that making decent GWT applications depends on understanding the underlying HTML that you are creating. In other words, you can&#8217;t get away with making a &#8230; <a href="http://www.zeddic.com/2011/11/introduction-to-gwt-ui-binders-templates/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As I touched on in a <a href="http://www.zeddic.com/2011/11/revisiting-html-document-flow-in-gwt/">recent post about HTML document flow</a>, I strongly believe that making decent GWT applications depends on understanding the underlying HTML that you are creating. In other words, you can&#8217;t get away with making a web application without actually understanding HTML and CSS <img src='http://www.zeddic.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Using GWT is no exception to this rule.</p>
<p>One of the biggest improvements I&#8217;ve seen in GWT in this respect is the introduction of <a href="http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html">UiBinders</a>, also known as &#8220;Declarative Layout&#8221;. UiBinders provide a way for you to declare the layout of your application and widgets using traditional HTML and CSS rather than programatically in java. This provides you with a much richer way to create your application.</p>
<p>Think of UiBinders as stateful templates. Unlike traditional templates that simply know how to render provided data into static HTML, UiBinder templates describe how a single Widget should be represented in the <a href="http://www.w3schools.com/htmldom/default.asp">DOM</a> <em>and </em>provides that widget with references to the created elements. This makes it easier for the widget to interact with the elements, such as setting up events or modifying content without having to make additional DOM lookups.</p>
<p>As an example, lets say you were creating a chat widget, similar to the chat windows found in Gmail or Google+. Since it&#8217;s quite tedious to make such a complex UI by hand in Java, you&#8217;d want to use a UiBinder template. In such a widget, you&#8217;d probably have a send button and some sort of panel that displays your chat log. In this case your widget could maintain references to those two elements in the DOM but leave their rendering and markup up to the template.</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/11/UIBinderTemplates-1.png"><img class="aligncenter size-full wp-image-207" title="UIBinderTemplates (1)" src="http://www.zeddic.com/wp-content/uploads/2011/11/UIBinderTemplates-1.png" alt="" width="442" height="363" /></a></p>
<h2>Example</h2>
<p>Ready for something more concrete? Lets see how this might look in code:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">class</span> ChatWidget <span style="color: #000000; font-weight: bold;">extends</span> <span style="color: #003399;">Composite</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; <span style="color: #666666; font-style: italic;">// The @UiField annotation tags elements that the widget should</span><br />
&nbsp; <span style="color: #666666; font-style: italic;">// maintain references too.</span><br />
&nbsp; @UiField <span style="color: #003399;">Button</span> sendButton<span style="color: #339933;">;</span><br />
&nbsp; @UiField DivElement chatLog<span style="color: #339933;">;</span><br />
<br />
&nbsp; @Inject<br />
&nbsp; ChatWidget<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; initWidget<span style="color: #009900;">&#40;</span>binder.<span style="color: #006633;">createAndBindUi</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; @UiHandler<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sendButton&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; <span style="color: #000066; font-weight: bold;">void</span> handleSendClick<span style="color: #009900;">&#40;</span>ClickEvent event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// send message...</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> appendMessage<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> message<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; chatLog.<span style="color: #006633;">setInnerText</span><span style="color: #009900;">&#40;</span>chatLog.<span style="color: #006633;">getInnerText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> message<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> Binder binder <span style="color: #339933;">=</span> GWT.<span style="color: #006633;">create</span><span style="color: #009900;">&#40;</span>Binder.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">interface</span> Binder <span style="color: #000000; font-weight: bold;">extends</span> UiBinder<span style="color: #339933;">&lt;</span>Widget, ChatWidget<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>And a corresponding ui.xml binder:</p>
<div class="codecolorer-container xml default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00bbdd;">&lt;!DOCTYPE ui:UiBinder SYSTEM &quot;http://dl.google.com/gwt/DTD/xhtml.ent&quot;&gt;</span><br />
<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui:UiBinder</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp;<span style="color: #000066;">xmlns:gwt</span>=<span style="color: #ff0000;">&quot;urn:import:com.google.gwt.user.client.ui&quot;</span></span><br />
<span style="color: #009900;"> &nbsp; &nbsp;<span style="color: #000066;">xmlns:ui</span>=<span style="color: #ff0000;">&quot;urn:ui:com.google.gwt.uibinder&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span><br />
<br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui:style<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; .log {<br />
&nbsp; &nbsp; &nbsp; border: 1px solid black;<br />
&nbsp; &nbsp; &nbsp; background: #CCC;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; .button {<br />
&nbsp; &nbsp; &nbsp; background: blue;<br />
&nbsp; &nbsp; }<br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ui:style<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; <br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gwt:HTMLPanel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
&nbsp; &nbsp; Chat History:<br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">ui:field</span>=<span style="color: #ff0000;">&quot;chatLog&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;{style.log}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gwt:Button</span> <span style="color: #000066;">ui:field</span>=<span style="color: #ff0000;">&quot;sendButton&quot;</span> <span style="color: #000066;">styleName</span>=<span style="color: #ff0000;">&quot;{style.button}&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span><br />
&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gwt:HTMLPanel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><br />
<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ui:UiBinder<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>&nbsp;</p>
<h2>Breaking the example down</h2>
<h3>Rendering the template</h3>
<p>There is quite a bit going on here &#8211; so lets break it down a bit. The first step in making your widget template aware is declare a custom UiBinder class and instantiate it using GWT.create(). This basically creates a class that can render your template on demand.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> Binder binder <span style="color: #339933;">=</span> GWT.<span style="color: #006633;">create</span><span style="color: #009900;">&#40;</span>Binder.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">interface</span> Binder <span style="color: #000000; font-weight: bold;">extends</span> UiBinder<span style="color: #339933;">&lt;</span>Widget, ChatWidget<span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span></div></div>
<p>The next step is to actually use your template. You can see this in the widget&#8217;s constructor where it calls binder.createAndBindUi(this). This effectively tells the binder to render a new instance of the template and bind it to the current widget. It&#8217;s here the all the magic is done in terms of providing the widget to the created DOM elements.</p>
<h3>Defining the Template</h3>
<p>When you define a Binder class, you should create a corresponding <em>WidgetName</em>.ui.xml. This xml file will contain both your html and css. </p>
<p>Your template files commonly have two top level elements: </p>
<ul>
<li>A ui:style tag that contains all of your css definitions for this template. You can reference these style names in this template file by using &#8220;{style.class-name}&#8221;</li>
<li>A root or top level widget for this template. In this example it&#8217;s the HTMLPanel. Note that you can <em>only have one</em> top level widget &#8211; everything else must go underneath</li>
</ul>
<p>Tip: An HTMLPanel is a common choice for use as a top level widget, since it allows you to mix raw html and widgets within your template. </p>
<h3>Setting up events and updating state</h3>
<p>To make your widget aware of elements in your template, you use the special &#8220;ui:field&#8221; attribute. Any element that has a field attribute can be referred to directly in your java class by defining a @UiField annotated member variable of a corresponding type. You can then have your class change the state, listen to events, change styles, etc &#8211; and have your changes updated in the UI immediately.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">// In ui.xml file:<br />
&lt;gwt:Button ui:field=&quot;myButton&quot; /&gt;<br />
<br />
// In java file:<br />
@UiField Button myButton;<br />
<br />
// Elsewhere in the java file:<br />
myButton.setText(&quot;Huzzah!&quot;);<br />
myButton.setEnabled(false);</div></div>
<p>Note that you can refer to both Widgets and underlying DOM elements in your template file. If you want to refer to a DOM element, you&#8217;ll need to use the <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/dom/client/Element.html">gwt dom classes</a>, such as DivElement or SpanElement</p>
<p>To listen to events, you can use GWT&#8217;s shorthand @UiHandler notation (warning: only works for widgets that expose that event). Simply annotate any method (name doesn&#8217;t matter) with @UiHandler(&#8220;fieldName&#8221;) and have it accept the relevant event as a parameter.</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;@UiHandler<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;sendButton&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; <span style="color: #000066; font-weight: bold;">void</span> handleSendClick<span style="color: #009900;">&#40;</span>ClickEvent event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// do something...</span><br />
&nbsp; <span style="color: #009900;">&#125;</span></div></div>
<p>The downside with the UiHandler annotation is that it only works with event&#8217;s that the widget normally exposes (such as click events on buttons). It doesn&#8217;t support any of the regular DOM events, so the second you want to go outside the fairly limited API it doesn&#8217;t work.</p>
<p>The common way to listen to any of those <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/event/dom/client/DomEvent.html">DOM events</a> is to use the &#8220;<a href="http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/user/client/ui/Widget.html#addDomHandler(H, com.google.gwt.event.dom.client.DomEvent.Type)">addDomHandler</a>&#8221; method. Example:</p>
<div class="codecolorer-container java default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sendButton.<span style="color: #006633;">addDomHandler</span><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">new</span> MouseOverHandler<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onMouseOver<span style="color: #009900;">&#40;</span>MouseOverEvent event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Do something.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; MouseOverEvent.<span style="color: #006633;">getType</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>&nbsp;</p>
<h2>Further Reading</h2>
<p>This should get you started with creating some basic templates. However, I also recommend giving <a href="http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html">GWT&#8217;s UIBinder documentation</a> a quick scan which that has lots of extra details.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zeddic.com/2011/11/introduction-to-gwt-ui-binders-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GWT widgets and their underlying HTML elements</title>
		<link>http://www.zeddic.com/2011/11/gwt-widgets-and-their-underlying-html-elements/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=gwt-widgets-and-their-underlying-html-elements</link>
		<comments>http://www.zeddic.com/2011/11/gwt-widgets-and-their-underlying-html-elements/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 21:59:37 +0000</pubDate>
		<dc:creator>Scott Bailey</dc:creator>
				<category><![CDATA[Google Web Toolkit]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.zeddic.com/?p=191</guid>
		<description><![CDATA[In GWT you often work on the Widget or Panel level when composing your UI&#8217;s. As I touched on in a recent post on document flow, each of these underlying widgets are built using a basic html element that affects the &#8230; <a href="http://www.zeddic.com/2011/11/gwt-widgets-and-their-underlying-html-elements/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In GWT you often work on the <a href="http://code.google.com/webtoolkit/doc/1.6/RefWidgetGallery.html">Widget or Panel level</a> when composing your UI&#8217;s. As I touched on in a <a href="http://www.zeddic.com/2011/11/revisiting-html-document-flow-in-gwt/">recent post on document flow</a>, each of these underlying widgets are built using a basic html element that affects the way they content is displayed on the screen.</p>
<p>Here&#8217;s a quick rundown on GWT widgets and what they map to in the HTML world:</p>
<table>
<thead>
<tr>
<th>Widget</th>
<th>Underlying Element</th>
<th>Display Type</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/user/client/ui/Anchor.html">Anchor</a>, Hyperlink</td>
<td>a</td>
<td>inline</td>
<td></td>
</tr>
<tr>
<td><a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/user/client/ui/Button.html">Button</a>, <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/user/client/ui/PushButton.html">PushButton</a>, <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/user/client/ui/ToggleButton.html">ToggleButton</a></td>
<td>button</td>
<td>inline</td>
<td></td>
</tr>
<tr>
<td valign="top"><a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/user/client/ui/FlowPanel.html">FlowPanel</a></td>
<td valign="top">div</td>
<td valign="top">block</td>
<td valign="top">A general stand-in for a div when it will only ever hold widgets. If you need to hold html too, consider the HTMLPanel.</td>
</tr>
<tr>
<td><a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/user/client/ui/HorizontalPanel.html">HorizontalPanel</a></td>
<td>table</td>
<td>table</td>
<td><span style="color: #ff0000;">Never use this widget.</span></td>
</tr>
<tr>
<td valign="top"><a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/user/client/ui/HTMLPanel.html">HTMLPanel</a></td>
<td valign="top">div or span (see notes)</td>
<td valign="top">block or inline</td>
<td valign="top">The HTMLPanel widget is a special widget that supports arbitrary html and widgets. It is normally used in in tandem with <a href="http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html">ui.xml templates</a>. Out of the box, it is represented<br />
as a div, but can be be implemented using any html element by using the &#8220;tag&#8221; attribute.</td>
</tr>
<tr>
<td><a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/user/client/ui/PopupPanel.html">PopupPanel</a></td>
<td>div</td>
<td>absolutly positioned block</td>
<td>Overlaid over existing document flow</td>
</tr>
<tr>
<td><a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/user/client/ui/SimplePanel.html">SimplePanel</a></td>
<td>div</td>
<td>block</td>
<td>A div with restrictions of only holding a single element.</td>
</tr>
<tr>
<td><a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/user/client/ui/SuggestBox.html">SuggestBox</a></td>
<td>input</td>
<td>inline</td>
<td></td>
</tr>
<tr>
<td><a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/user/client/ui/TextArea.html">TextArea</a></td>
<td>textarea</td>
<td>inline</td>
<td></td>
</tr>
<tr>
<td><a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/user/client/ui/TextBox.html">TextBox</a></td>
<td>input</td>
<td>inline</td>
<td></td>
</tr>
<tr>
<td><a href="http://google-web-toolkit.googlecode.com/svn/javadoc/2.4/com/google/gwt/user/client/ui/VerticalPanel.html">VerticalPanel</a></td>
<td>table</td>
<td>table</td>
<td><span style="color: #ff0000;">Never use this widget.</span></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.zeddic.com/2011/11/gwt-widgets-and-their-underlying-html-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Revisiting HTML document flow in GWT</title>
		<link>http://www.zeddic.com/2011/11/revisiting-html-document-flow-in-gwt/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=revisiting-html-document-flow-in-gwt</link>
		<comments>http://www.zeddic.com/2011/11/revisiting-html-document-flow-in-gwt/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 21:30:32 +0000</pubDate>
		<dc:creator>Scott Bailey</dc:creator>
				<category><![CDATA[Google Web Toolkit]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.zeddic.com/?p=167</guid>
		<description><![CDATA[One of the more common mistakes I see in GWT development is to forget that behind all the widgets, and panels, and abstractions of GWT, your application is fundamentally still HTML, CSS, and Javascript. On it&#8217;s own, GWT simplifies your &#8230; <a href="http://www.zeddic.com/2011/11/revisiting-html-document-flow-in-gwt/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of the more common mistakes I see in GWT development is to forget that behind all the widgets, and panels, and abstractions of GWT, your application is fundamentally still HTML, CSS, and Javascript.</p>
<p>On it&#8217;s own, GWT simplifies your javascript development and provides a framework to help with building your UI. It is not, however, a replacement for understanding HTML and basic CSS. I firmly believe that to make a decent GWT application, you need to have an understanding of how it all works together.</p>
<p>That said, here&#8217;s a brief re-cap of some of the fundamentals of HTML document flow that&#8217;s easy to look over when you&#8217;re working in GWT land:</p>
<h2>Document Flow: Block, Inline, &amp; Inline-Block</h2>
<p>Every html element contributes to the flow of content on the page. Most of these elements are classified as either block level elements or inline elements, which affects how they fit into the flow of content. Elements may have their natural display mode changed via CSS by setting the display attribute.</p>
<h3><span style="text-decoration: underline;">Block Elements</span></h3>
<p>Block elements span the entire width of their parent element and cause the next element to start on a new line. In effect, they stack on top of each other like blocks. Block level elements accept the full range of css margin and padding styling.</p>
<p>Examples include: &lt;div&gt;, &lt;p&gt;, &lt;form&gt;, &lt;blockquote&gt;, &lt;h1&gt;, &lt;h2&gt;, and &lt;ul&gt;.</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/11/div.png"><img class="aligncenter size-full wp-image-168" title="div" src="http://www.zeddic.com/wp-content/uploads/2011/11/div.png" alt="" width="717" height="335" /></a></p>
<h3><span style="text-decoration: underline;">Inline Elements</span></h3>
<p><strong> </strong>Inline elements, on the other hand, fit into the regular flow of text on the page and will automatically wrap when they reach the end of a line. Think of them as individual words or glyphs. Some special notes when dealing with inline elements:</p>
<p>- No width or height can be set<br />
- While padding and margins can be set, only the horizontal values will affect content<br />
- <em>Never</em> put a block level element inside of a inline level element</p>
<p>Examples include: &lt;span&gt;, &lt;a&gt;, &lt;em&gt;, &lt;strong&gt;, &lt;input&gt;, &lt;button&gt;, &lt;image&gt;</p>
<p><span style="text-decoration: underline;"><a href="http://www.zeddic.com/wp-content/uploads/2011/11/span.png"><img class="aligncenter size-full wp-image-169" title="span" src="http://www.zeddic.com/wp-content/uploads/2011/11/span.png" alt="" width="699" height="290" /></a></span></p>
<h3><span style="text-decoration: underline;">Inline Block &#8211; The Hybrid</span></h3>
<p><strong> </strong>Inline-block elements are a hybrid of block and inline block elements. They get the benefit of fitting into the flow of text like inline-elements, but they still support width, height, padding, and margin. Lets say you were to make a custom button in GWT with your own styling: you would probably end up using an inline-block display mode so you could get all your dimensions the way you want.</p>
<p>Inline-block is<a href="http://www.quirksmode.org/css/display.html"> only recently cross-browser compatible</a> &#8211; and you may run into a few quirks when working with IE6/7 (every other browser should work fine). My golden rule for working with it that tends to get rid of 99% of cross browser problems: <span style="text-decoration: underline;">only ever set display:inline-block on elements that are naturally inline elements.</span></p>
<p><span style="text-decoration: underline;"><br />
</span></p>
<h3><span style="text-decoration: underline;">Fitting them all together</span></h3>
<p><strong><br />
<a href="http://www.zeddic.com/wp-content/uploads/2011/11/span_div.png"><img class="aligncenter size-full wp-image-171" title="span_div" src="http://www.zeddic.com/wp-content/uploads/2011/11/span_div.png" alt="" width="705" height="570" /></a></strong></p>
<p>&nbsp;</p>
<h2>Where do GWT widgets fit in?</h2>
<p>Each GWT widget is implemented using an underlying native HTML element that will affect the document flow. When you use a widget, its important to realize what element you&#8217;re using behind the scenes, otherwise your your layout starts to become very haphazard. For reference, <a href="http://www.zeddic.com/2011/11/gwt-widgets-and-their-underlying-html-elements/">I&#8217;ve created a short table of some of the more common widgets</a>.</p>
<p>Generally, most panel widgets are divs (blocks) and inputs, buttons, links, etc. map to their corresponding span elements as you would expect.</p>
<p>The exception to this rule is the HorizontalPanel and VerticalPanel. These widgets use table elements behind the scenes, and I <em><a href="http://en.wikipedia.org/wiki/Tableless_web_design">strongly recommend you never use them for layout purposes</a>.</em></p>
<p>&nbsp;</p>
<h2>Common Document Flow Mistakes in GWT</h2>
<ul>
<li>Don&#8217;t set width 100% of block level elements. Block level elements naturally expand to fill their parent element horizontally &#8211; making the width 100% redundant. Even worse &#8211; width 100% is additive with padding and margin which can cause your div to expand outside of its parent all together.(The only exception to this rule would be if you are trying to clear floats using the <a href="http://www.quirksmode.org/css/clearing.html">overflow:auto technique</a>. Still be on the lookout for margin and padding issues though)</li>
<li>Don&#8217;t put a width, height, or vertical padding/margin on inline elements &#8211; they have no affect. If you need them &#8211; use inline-block elements. Another common technique to force vertical size is to apply a css line-height to the span.</li>
<li>Never put display:inline-block on div&#8217;s or natural block elements. You&#8217;ll run into problems with IE6 and IE7.</li>
<li>Never use tables for document layout purposes. This means that HorizontalPanel and VerticalPanel are <em>strictly off limits</em>.</li>
<li>Never put a block level element inside a inline or inline-block level element.</li>
<li>Clear your floats, otherwise you&#8217;ll run into problems with the content overlapping the document down stream. Two common techniques are to put a clearing block (&lt;div style=&#8221;clear:both&#8221;/&gt;) or using the <a href="http://www.quirksmode.org/css/clearing.html">overflow:auto</a> technique.</li>
</ul>
<p><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zeddic.com/2011/11/revisiting-html-document-flow-in-gwt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with GWT</title>
		<link>http://www.zeddic.com/2011/10/getting-started-with-gwt/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-started-with-gwt</link>
		<comments>http://www.zeddic.com/2011/10/getting-started-with-gwt/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 08:54:08 +0000</pubDate>
		<dc:creator>Scott Bailey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Google Web Toolkit]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.zeddic.com/?p=147</guid>
		<description><![CDATA[Google Web Toolkit (GWT) is a useful development framework intended for building complex javascript applications. It&#8217;s used fairly heavily in Google products, and if you&#8217;ve used different Google services in the past, it&#8217;s likely that at least a few were &#8230; <a href="http://www.zeddic.com/2011/10/getting-started-with-gwt/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/webtoolkit/">Google Web Toolkit (GWT)</a> is a useful development framework intended for building complex javascript applications. It&#8217;s used fairly heavily in <a href="https://adwords.google.com/">Google products</a>, and if you&#8217;ve used different Google services in the past, it&#8217;s likely that at least a few were built using GWT.</p>
<p>One of the interesting things about GWT is that it allows you to build your web application in Java. This has its pluses and minus, but generally this means that you can you reap all the benefits of a language with a developed tool chain (ie Eclipse). This may not seem like much for a small project (and might even be overkill), but for complex projects it can be extremely useful. It makes it easier to build, maintain, refactor, and test your product &#8211; which can become tricky when working with a big js code base.</p>
<p>To bridge the world of Java and Javascript, GWT uses a compiler. Your Java application is compiled into minified and obfuscated javascript files. To handle cross browser compatibility, GWT generates multiple &#8220;permutations&#8221; of your compiled application: one version for each for each browser. When your application is loaded in a web browser, GWT is able to detect the user&#8217;s current browser and load the right one for you.</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/10/GWTPermutations.png"><img class="aligncenter size-large wp-image-148" title="GWTPermutations" src="http://www.zeddic.com/wp-content/uploads/2011/10/GWTPermutations-900x675.png" alt="" width="640" height="480" /></a></p>
<p>With me so far? Want to give GWT a whril? Heres a few steps to get you started with a development environment. For the most part, these are just streamlined instructions from GWT&#8217;s <a href="http://code.google.com/webtoolkit/gettingstarted.html">Getting Started</a> documentation. I prefer working with Eclipse, so these steps will show you how to get setup with it.</p>
<p><strong>1.) Download Eclipse</strong><br />
If you don&#8217;t have Eclipse installed yet, head on over to the <a href="http://www.eclipse.org/downloads/">Eclipse Download</a> page. As of this writing I&#8217;m using Eclipse 3.7 for Java Developers.</p>
<p><strong>2.) Download and Install the GWT SDK + Plugin within Eclipse<br />
</strong>Once Eclipse is setup, your next step is to download and install the GWT SDK. You can do this entirely within Eclipse using their &#8220;Install new Software&#8221; dialog.</p>
<p>Click Help &#8211;&gt; Install new Software</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/10/install-new.png"><img class="aligncenter size-full wp-image-151" title="install-new" src="http://www.zeddic.com/wp-content/uploads/2011/10/install-new.png" alt="" width="349" height="348" /></a></p>
<p>Next, <a href="http://code.google.com/eclipse/docs/download.html">enter the site</a> that matches your version of Eclipse.</p>
<p>(Indigo) http://dl.google.com/eclipse/plugin/3.7<br />
(Helios) http://dl.google.com/eclipse/plugin/3.6<br />
(Galileo) http://dl.google.com/eclipse/plugin/3.5</p>
<p>Next, place checks next to &#8220;Google Plugin for Eclipse&#8221;, and the &#8220;Google Web Toolkit SDK&#8221; (You can download the others if you want &#8211; they can be useful if you intend to deploy your application to App Engine, but aren&#8217;t strictly needed)</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/10/sdk-install.png"><img class="aligncenter size-full wp-image-152" title="sdk-install" src="http://www.zeddic.com/wp-content/uploads/2011/10/sdk-install.png" alt="" width="720" height="274" /></a></p>
<p>Click Next and Finish the installation wizard. It will take a few minutes while Eclipse downloads the SDK and installs it. At the end, Eclipse will restart to finish the installation.</p>
<p><strong>3.) Create an Empty GWT Project</strong></p>
<p>Now that your environment is setup, it&#8217;s time to create a simply GWT application. In Eclipse, click on File &#8211;&gt; New &#8211;&gt; Web Application Project</p>
<p>In the new dialog uncheck &#8220;Use Google App Engine&#8221;, and check &#8220;Generate project sample code&#8221;.</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/10/new-project.png"><img class="aligncenter size-full wp-image-154" title="new-project" src="http://www.zeddic.com/wp-content/uploads/2011/10/new-project.png" alt="" width="525" height="716" /></a></p>
<p>With that, Eclipse should auto-generate a bare-bones GWT application for you. One thing to note is that it puts the sample code into 3 main packages:</p>
<p><strong>client</strong>: All your gwt application code goes here. Everything here will be compiled to javascript.</p>
<p><strong>server</strong>: This is server side code that may handle ajax requests from your application via <a href="http://code.google.com/webtoolkit/doc/latest/tutorial/RPC.html">gwt rpc</a>. For example, if your application were to communicate with a backend to get data through a database, it would call a service you program here. This is pure java code and isn&#8217;t intended to be compiled into javascript. Keep in mind that you are <strong>not required</strong> to use gwt rpc or program a service here. You can just as easily have a server written in PHP and have your gwt application <a href="http://code.google.com/webtoolkit/doc/latest/tutorial/JSON.html">communicate via JSON</a> (or not have any backend at all)</p>
<p><strong>shared: </strong>This is intended for shared classes between the server and client. These classes will be available in your server side code AND will be compiled into javascript. This is where you would put classes and interfaces for objects that you are sending via gwt rpc.</p>
<p><strong>4.) Run your application in Development Mode<br />
</strong>When eclipse created your project, it should have setup a default run and debug configuration for you. To kick off your application, try run &#8211;&gt; <em>project_name</em></p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/10/run-as.png"><img class="aligncenter size-full wp-image-155" title="run-as" src="http://www.zeddic.com/wp-content/uploads/2011/10/run-as.png" alt="" width="258" height="228" /></a></p>
<p>&nbsp;</p>
<p>In a second or so, you should see &#8220;Development Mode&#8221; tab appear with a link that you can use to view your application in a browser. Go ahead and hit the link and you should see the application popup in your browser (you may be prompted to install a GWT development plugin first)</p>
<p><span style="text-decoration: underline;">Protip:</span> I recommend using Firefox here &#8211; the GWT plugin performs ~2x faster in Firefox than in Chrome due to the way the extension APIs are built for each.</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/10/dev-mode.png"><img class="aligncenter size-full wp-image-156" title="dev-mode" src="http://www.zeddic.com/wp-content/uploads/2011/10/dev-mode.png" alt="" width="797" height="134" /></a></p>
<p>&nbsp;</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/10/starter.png"><img class="aligncenter size-full wp-image-157" title="starter" src="http://www.zeddic.com/wp-content/uploads/2011/10/starter.png" alt="" width="503" height="532" /></a></p>
<p>Whats going on here? For development purposes GWT uses something special called &#8220;<a href="http://code.google.com/webtoolkit/doc/latest/tutorial/gettingstarted.html">hosted mode</a>&#8220;. Basically, during development GWT doesn&#8217;t bother fully compiling your java into javascript. Instead &#8211; it talks with your browser via a special plugin and creates the javascript on demand.</p>
<p>Why is this important? Basically it means <span style="text-decoration: underline; color: #000000;">you can change any of your java code in your client, save, hit refresh, and see the changes instantly in your browser</span>. Just like when working with regular javascript and HTML.</p>
<p>In the early days of GWT you used to need to re-compile the application every time you wanted to see your changes. Theres no need to do that now &#8211; it just wastes precious time when your developing your application.</p>
<p><strong> <strong>5.) Compile your Application<br />
</strong></strong>Ready for others to see your application? Since others won&#8217;t have hosted mode, you&#8217;ll need to actually compile everything into plain-ol&#8217;-javascript and HTML first. To do that:</p>
<p>Right Click on your project &#8211;&gt; Google &#8211;&gt; GWT Compile</p>
<p>Within the new dialog, simply click &#8220;Compile&#8221;</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/10/gwt-compile1.png"><img class="aligncenter size-full wp-image-158" title="gwt-compile1" src="http://www.zeddic.com/wp-content/uploads/2011/10/gwt-compile1.png" alt="" width="703" height="267" /></a></p>
<p>&nbsp;</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/10/gwt-compile2.png"><img class="aligncenter size-full wp-image-159" title="gwt-compile2" src="http://www.zeddic.com/wp-content/uploads/2011/10/gwt-compile2.png" alt="" width="536" height="478" /></a></p>
<p>You&#8217;ll see GWT work while a while while it does it&#8217;s magic: obfuscating, minimizing, prunning dead code&#8230; (aren&#8217;t you glad you weren&#8217;t running this every time you wanted to see a change?)</p>
<p>When done, you&#8217;ll see it output your completed compiled project in your war/ folder. Want to runthe finished product? Just open the root .html file in any browser. When it&#8217;s time to deploy, simply upload your .html and project/ folder to your web server.</p>
<p>&nbsp;</p>
<p><strong>Next Steps?<br />
</strong>Now that you have a bare-bones GWT development environment setup, you&#8217;re free to start building away!</p>
<p>Not sure how to start? Google has some <a href="http://code.google.com/webtoolkit/doc/latest/tutorial/gettingstarted.html">decent documentation</a>, though it can be sometimes be a bit daunting for a beginner.  If you want something easier &#8211; I&#8217;m planning on adding some more tutorials on programming in GWT here. Feel free to add a ping in the comment section if interested!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zeddic.com/2011/10/getting-started-with-gwt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating an opaque background for photoshop paintings</title>
		<link>http://www.zeddic.com/2011/05/creating-an-opaque-background-for-photoshop-paintings/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-an-opaque-background-for-photoshop-paintings</link>
		<comments>http://www.zeddic.com/2011/05/creating-an-opaque-background-for-photoshop-paintings/#comments</comments>
		<pubDate>Sun, 22 May 2011 03:21:34 +0000</pubDate>
		<dc:creator>Scott Bailey</dc:creator>
				<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[getting started]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.zeddic.com/?p=107</guid>
		<description><![CDATA[A Photoshop technique I was recently asked about was how to create a semi-transparent background for tracing. This involves creating a layer with a low opacity that you can then draw or paint over, usually with a pen tablet. As an example, &#8230; <a href="http://www.zeddic.com/2011/05/creating-an-opaque-background-for-photoshop-paintings/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A Photoshop technique I was recently asked about was how to create a semi-transparent background for tracing. This involves creating a layer with a low opacity that you can then draw or paint over, usually with a pen tablet.</p>
<p>As an example, lets say that you&#8217;ve taken a photo of a sunset that you&#8217;d then like to use for a painting. Here&#8217;s how you&#8217;d set it up for your painting session:</p>
<p>First off, create a new Photoshop canvas (File &#8211;&gt; New). If you plan on doing some painting, be sure to keep the resolution decently high so you have some room to work.</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/05/1_new_painting.png"><img class="alignnone size-full wp-image-117" title="1_new_painting" src="http://www.zeddic.com/wp-content/uploads/2011/05/1_new_painting.png" alt="" width="670" height="473" /></a></p>
<p>Now that you have your canvas ready, lets load the photo that you want to trace. Hit &#8220;File &#8211;&gt; Open&#8221;</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/05/2_open_existing.png"><img class="alignnone size-full wp-image-118" title="2_open_existing" src="http://www.zeddic.com/wp-content/uploads/2011/05/2_open_existing.png" alt="" width="314" height="126" /></a></p>
<p>&nbsp;</p>
<p>Now you&#8217;ll have two separate canvases open. You&#8217;ll want to copy / paste the photo into your first canvas. To do this, press:</p>
<p>Select all: Press Ctrl + A<br />
Copy: Press Ctrl + C<br />
Switch over to the original drawing canvas<br />
Paste: Press Ctrl + V</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/05/3_select_all.png"><img class="alignnone size-full wp-image-119" title="3_select_all" src="http://www.zeddic.com/wp-content/uploads/2011/05/3_select_all.png" alt="" width="763" height="559" /></a></p>
<p>Heres what it looks like after you&#8217;ve pasted in the image to your first canvas:</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/05/4_paste_into.png"><img class="alignnone size-large wp-image-120" title="4_paste_into" src="http://www.zeddic.com/wp-content/uploads/2011/05/4_paste_into-900x680.png" alt="" width="640" height="483" /></a></p>
<p>Now that the image is pasted into your canvas, you&#8217;ll need to resize the image to fill all the space. Hit &#8220;Edit &#8211;&gt; Free Transform&#8221;</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/05/5_free_transform.png"><img class="alignnone size-full wp-image-121" title="5_free_transform" src="http://www.zeddic.com/wp-content/uploads/2011/05/5_free_transform.png" alt="" width="320" height="498" /></a></p>
<p>You&#8217;ll see small &#8216;pips&#8217; or corners appear on each of the corners of the image you&#8217;ve pasted. You can click and drag them resize it to fill the entire space. Hold down the shift key while you do it and the image will keep the right proportions. You can also click and drag on the body of the image to keep it centered on the page. When you have the image where you want it, press enter to apply your transformation.</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/05/6_resize.png"><img class="alignnone size-large wp-image-122" title="6_resize" src="http://www.zeddic.com/wp-content/uploads/2011/05/6_resize-900x680.png" alt="" width="640" height="483" /></a></p>
<p>Heres what it looks like now that we have it all centered.</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/05/7_resized.png"><img class="alignnone size-large wp-image-123" title="7_resized" src="http://www.zeddic.com/wp-content/uploads/2011/05/7_resized-900x680.png" alt="" width="640" height="483" /></a></p>
<p>Now it&#8217;s time to create the layer that you&#8217;re going to draw on. On the layer panel (usually in the bottom right) click on the new layer button. Before being able to draw on it, you&#8217;ll need to select it by clicking on it.</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/05/8_overlay_layer.png"><img class="alignnone size-full wp-image-124" title="8_overlay_layer" src="http://www.zeddic.com/wp-content/uploads/2011/05/8_overlay_layer.png" alt="" width="224" height="298" /></a></p>
<p>You&#8217;ll also want to lower the opacity of the of the photo layer so you can still see your painting above it. Click on the photo layer then click and drag the opacity slider near the top of the layer panel.</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/05/9_lower_opacity.png"><img class="alignnone size-full wp-image-125" title="9_lower_opacity" src="http://www.zeddic.com/wp-content/uploads/2011/05/9_lower_opacity.png" alt="" width="226" height="157" /></a></p>
<p>You&#8217;re drawing canvas should now look like this:</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/05/10_opacity.png"><img class="alignnone size-large wp-image-126" title="10_opacity" src="http://www.zeddic.com/wp-content/uploads/2011/05/10_opacity-900x680.png" alt="" width="640" height="483" /></a></p>
<p>You&#8217;ll notice that its a bit hard to see since there is no background color to your drawing. Lets finish up everything by creating a third layer thats just solid white.</p>
<p>Hit the &#8220;new layer&#8221; button to create a third layer. Drag it to the bottom of the layer stack. Now it&#8217;s time to fill in the background layer with a solid color. Click on the paint tool, then select a solid white color from the palette. You can then click on the canvas to fill it.</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/05/paint_tool.png"><img class="alignnone size-full wp-image-131" title="paint_tool" src="http://www.zeddic.com/wp-content/uploads/2011/05/paint_tool.png" alt="" width="194" height="342" /></a></p>
<p>Heres how your layers should now look:</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/05/11_all_layers.png"><img class="alignnone size-full wp-image-127" title="11_all_layers" src="http://www.zeddic.com/wp-content/uploads/2011/05/11_all_layers.png" alt="" width="223" height="193" /></a></p>
<p>And how your final image should now look:</p>
<p><a href="http://www.zeddic.com/wp-content/uploads/2011/05/12_white_background.png"><img class="alignnone size-large wp-image-128" title="12_white_background" src="http://www.zeddic.com/wp-content/uploads/2011/05/12_white_background-900x680.png" alt="" width="640" height="483" /></a></p>
<p>And done! Now enjoy your your painting!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zeddic.com/2011/05/creating-an-opaque-background-for-photoshop-paintings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

