File: faq.html

package info (click to toggle)
libjgoodies-forms-java 1.0.5-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,696 kB
  • ctags: 1,280
  • sloc: java: 7,315; xml: 209; makefile: 11
file content (478 lines) | stat: -rw-r--r-- 22,146 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>JGoodies Forms :: FAQ</title>
        <link rel="stylesheet" type="text/css" href="style.css" >
	<meta name="description" content="The JGoodies Forms helps you layout and implement elegant Panel quickly and consistently.">
	<meta name="author"	 content="Karsten Lentzsch">
	<meta name="keywords"	 content="JGoodies Forms Java Layout Swing UI Design Usability Lentzsch Kiel">
	<meta name="robots"	 content="index, follow">
	<meta name="date"	 content="2003-08-29">
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0" bottommargin="0" >

<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
    <td colspan="3" bgcolor="DDDCDC"><a href="../README.html"><img 
	src="images/banner.gif" width="436" height="46" alt=":: JGOODIES :: Forms" border="0"></a></td>
</tr>
<tr>
    <td colspan="3" height="1" bgcolor="C9C8C8"></td>
</tr>
<tr>
    <td width="160" height="500" valign="top" bgcolor="F4f3f3" class="nav" nowrap="nowrap">
    <div style="margin-left: 17px; margin-top: 17px; margin-right: 10px; ; margin-bottom: 17px; line-height: 18px;">

        <!-- ************ Anfang der Seitennavigation **************************** -->

	<b>General</b>
	<br>::&nbsp;<a class="nav" href="../README.html">Readme</a>
	<br>::&nbsp;<a class="nav" href="../RELEASE-NOTES.txt">Release Notes</a>
	<br>::&nbsp;<a class="nav" href="../LICENSE.txt">License</a>
	<br>::&nbsp;<a class="nav" href="whitepaper.pdf">Whitepaper</a>
	<br>::&nbsp;<a class="nav" href="visualbuilders.html">Visual Builders</a>
	<br>::&nbsp;<a class="nav" href="references.html">References</a>
	<br>::&nbsp;<a class="nav" href="tips.html">Tips &amp; Tricks</a>
	<br>::&nbsp;<a class="nav" href="faq.html"><b>FAQ</b></a>
	<p>
	<b>Tutorial</b>
	<br>::&nbsp;<a class="nav" href="tutorial/introduction.html">Introduction</a>
	<br>::&nbsp;<a class="nav" href="tutorial/quickstart.html">Quick Start</a>
	<br>::&nbsp;<a class="nav" href="tutorial/basics.html">Basics</a>
	<br>::&nbsp;<a class="nav" href="tutorial/building.html">Building</a>
	<br>::&nbsp;<a class="nav" href="tutorial/factories.html">Factories</a>
	<p>
	<b>Reference</b>
	<br>::&nbsp;<a class="nav" href="reference/alignments.html">Alignments</a>
	<br>::&nbsp;<a class="nav" href="reference/constantsizes.html">Constant Sizes</a>
	<br>::&nbsp;<a class="nav" href="reference/componentsizes.html">Component Sizes</a>
	<br>::&nbsp;<a class="nav" href="reference/boundedsizes.html">Bounded Sizes</a>
	<br>::&nbsp;<a class="nav" href="reference/colsandrows.html">Cols &amp; Rows</a>
	<br>::&nbsp;<a class="nav" href="reference/cells.html">Cell Constraints</a>
	<br>::&nbsp;<a class="nav" href="reference/groups.html">Groups</a>
	<p>
	<a class="nav" href="api/index.html"><b>API Docs</b></a>
	<p>
	<b>Web Pages</b>
	<br>::&nbsp;<a class="nav" href="http://forms.dev.java.net/">Project Home</a>
	<br>::&nbsp;<a class="nav" href="http://forms.dev.java.net/servlets/ProjectDocumentList">Downloads</a>
	<br>::&nbsp;<a class="nav" href="http://forms.dev.java.net/servlets/ProjectNewsList">Announcements</a>
	<br>::&nbsp;<a class="nav" href="http://forms.dev.java.net/servlets/ProjectMailingListList">Mailing Lists</a>
	<br>::&nbsp;<a class="nav" href="http://forms.dev.java.net/servlets/ProjectIssues">Issue Tracker</a>
	<br>::&nbsp;<a class="nav" href="http://www.jgoodies.com/freeware/">More Examples</a>
        
         <!-- *********** Ende der Seitennavigation ******************************* -->

    </div>
    </td>
    <td width="1" bgcolor="E7E5E5"><img src="/images/banner.gif" width="1" height="1" alt=""></td>
    <td width="90%" valign="top" >
	<div style="margin-left: 20px; margin-top: 17px; margin-bottom: 17px">

        <!-- ************ Anfang des Inhalts ***************************************** -->
	
	<table width="530" border="0" cellspacing="0" cellpadding="0">
	<tr>
	  <td>
	  
	<h1>:: Frequently Asked Questions ::</h1>

	<h2>1. General</h2>
    <p>
		    &nbsp;<a href="#1.1">1.1 - What are the main benefits of the Forms?</a>
		<br>&nbsp;<a href="#1.2">1.2 - Can I use the Forms in a commercial product?</a>
		<br>&nbsp;<a href="#1.3">1.3 - Where do I get the latest version?</a>
		<br>&nbsp;<a href="#1.4">1.4 - Where do I get support?</a>
		<br>&nbsp;<a href="#1.5">1.5 - How can I help improve the Forms?</a>
		<br>&nbsp;<a href="#1.6">1.6 - Which layout managers complement the FormLayout?</a>
		<br>&nbsp;<a href="#1.7">1.7 - Are there visual builders that support the FormLayout?</a>
		<br>&nbsp;<a href="#1.8">1.8 - Can I use FormLayout with the SWT?</a>


	<h2>2. Working With Layout</h2>
    <p>
		    &nbsp;<a href="#2.1">2.1 - How to give columns a percentage of the available space?</a>
		<br>&nbsp;<a href="#2.2">2.2 - How to assign the same width to two or more columns?</a>
		<br>&nbsp;<a href="#2.3">2.3 - How can I append a custom row using the DefaultFormBuilder?</a>
		<br>&nbsp;<a href="#2.4">2.4 - How can I append a custom area using the DefaultFormBuilder?</a>
		<br>&nbsp;<a href="#2.5">2.5 - How can I identify and understand layout problems?</a>
		<br>&nbsp;<a href="#2.6">2.6 - How can I remove a component from the layout?</a>


	<h2>3. Understanding FormLayout</h2>
    <p>
		    &nbsp;<a href="#3.1">3.1 - What does the 'fill' alignment do?</a>
		<br>&nbsp;<a href="#3.2">3.2 - When is it recommended to use the 'pref' size instead of 'default'?</a>
		<br>&nbsp;<a href="#3.3">3.3 - Why don't components in growing rows fill the vertical space?</a>
		<br>&nbsp;<a href="#3.4">3.4 - Why don't components that span multiple columns affect the column widths?</a>
		<br>&nbsp;<a href="#3.5">3.5 - Why do components that span multiple columns affect the container width?</a>
		<br>&nbsp;<a href="#3.6">3.6 - Why do some text areas grow but never shrink again?</a>


	
	<h1>:: 1. General ::</h2>
	
		<h2><a name="1.1">1.1 - What are the main benefits of the Forms?</a></h2>

		Forms aims to make the layout process faster, better and easier. 
		It makes simple things easy and the hard stuff possible, 
		good design easy and the bad difficult.


		<h2><a name="1.2">1.2 - Can I use the Forms in a commercial product?</a></h2>

		You can use and redistribute the Forms in source and binary form
		- even for commercial use - if you comply with the terms of the 
		<a href="../LICENSE.txt">BSD open source license</a>.


		<h2><a name="1.3">1.3 - Where do I get the latest version?</a></h2>

		The latest version is available in the project's 
		<a href="https://forms.dev.java.net/servlets/ProjectDocumentList">download</a>
		section. There you can get the library, 
		sources, tutorial, documentation, the whitepaper, and the Forms Demo.
		

		<h2><a name="1.4">1.4 - Where do I get support?</a></h2>

	    <b>Please check this FAQ and do&nbsp;not&nbsp;send personal mail!</b>
	    <p>

		You may subscribe to the 
		<a href="https://forms.dev.java.net/servlets/ProjectMailingListList">users mailing list</a> 
		and  
		<a href="https://forms.dev.java.net/servlets/SummarizeList?listName=users&by=subject">browse</a>
		or
		<a href="https://forms.dev.java.net/servlets/SearchList?listName=users&by=subject">search</a>
		the list's archive.
		And you can direct new questions to 
		<a href="mailto:users@forms.dev.java.net">users@forms.dev.java.net</a>.
		Please 
		<a href="https://forms.dev.java.net/servlets/ProjectMailingListList">register</a> 
        with this list before you post; otherwise I need to manually accept your messages.
	    
        Also, you can use the 
        <a href="https://forms.dev.java.net/servlets/ProjectIssues">issue tracker</a>
        to find issues regarding the Forms. As a project observer you can log defects, 
        request features and suggest enhancements.
	
		<p>
		Priority support is available for commercial licensees of the 
		<a href="http://www.jgoodies.com/products/index.html">JGoodies Swing Suite</a>. 
		These can contact us by phone or direct questions to support@JGoodies.com.
		

		<h2><a name="1.5">1.5 - How can I help improve the Forms?</a></h2>

		You can send feedback and suggestions regarding the
		Forms API, builder classes and all related issues to the 
		<a href="https://forms.dev.java.net/servlets/ProjectMailingListList">users mailing list</a>.
	    
		And you can report bugs and enter feature requests in the
		<a href="https://forms.dev.java.net/servlets/ProjectIssues">issue tracker</a>.
		 
		<p>
		Professional users that save time and money using the Forms
		can help me finance my Java desktop activities
		by licensing the commercial
		<a href="http://www.jgoodies.com/products/index.html">JGoodies Swing Suite</a>.	
		
		
		<h2><a name="1.6">1.6 - Which layout managers complement the FormLayout?</a></h2>

		<a href="http://www.zookitec.com/explicitlayout.html">ExplicitLayout</a>
		complements the FormLayout when it comes to non-rectangular layouts, 
		for example if you want to position components along a curve.<p>
		
		The highly extensible SpringLayout can implement a huge class of layouts,
		but it is quite difficult to understand.
		You may consider using it if neither FormLayout nor ExplicitLayout do a good job,
		or if you want to implement a non-grid-based layout with a layout manager
		that ships with the JDK.<p>
		
		Allthough the FormLayout is intended to replace the GridBagLayout,
		the latter is still a good choice, if you cannot add a third party
		layout manager like FormLayout.
		
		
		<h2><a name="1.7">1.7 - Are there visual builders that support the FormLayout?</a></h2>

		There are a couple of <a href="visualbuilders.html">visual builders</a> 
		that support the JGoodies FormLayout and/or the whole Forms framework 
		including the factories and non-visual builders.
			
		
		<h2><a name="1.8">1.8 - Can I use the FormLayout with the SWT?</a></h2>

		Florian Fankhauser has ported the FormLayout and parts
		of the Forms builders to the SWT,
		see <a href="http://ffxml.net/swtforms/">SwtForms</a>.




	<p>&nbsp;<br>
	
	<h1>:: 2. Working With Layout ::</h2>
	
		<h2><a name="2.1">2.1 - How to give columns a percentage of the available space?</a></h2>

		If all components have an initial size of 0 pixel, then the resize
		weight can be used as percentage of the available space. 
		For example <tt>&quot;0:g(0.25), 0:g(0.75)&quot;</tt> gives the first column
		25% of the available space and the second column 75%.
		<p>
		More generally, the resize weights distribute the available
		extra space of the growing columns/rows. The extra space is
		<i>container space - insets -  fixed space</i>.


		<h2><a name="2.2">2.2 - How to assign the same width to two or more columns?</a></h2>

		You can either use the same constant size for all columns,
		or you can group the columns using <tt>FormLayout#setColumnGroups(int[][])</tt>.
		The latter mechanism gives columns in a group the same width
		after their normal width has been computed.<p>
		
		The distribution of extra space is the last step; it happens
		after the group elements have been equalized. To make columns
		equal wide, ensure that they have the same growing weight assigned
		(the default is <tt>1.0</tt>).
		
		
		<h2><a name="2.3">2.3 - How can I append a custom row using the DefaultFormBuilder?</a></h2>

		You can append a custom row using <tt>DefaultFormBuilder#appendRow(RowSpec)</tt>.
		However, you may consider using a combination of standard rows 
		to achieve a more regular layout grid and regular layout row heights
		and row alignments.<p>
		
		The Forms tutorial contains the <tt>DefaultFormWithCustomRowsExample</tt> class
		that demonstrates three approaches for appending a custom row.
		These differ in the position of the leading label, the alignment 
		of font baselines and the height of the custom row.
		

		<h2><a name="2.4">2.4 - How to assign the same width to two or more columns?</a></h2>

		You can append a custom area using <tt>DefaultFormBuilder#appendRow(RowSpec)</tt>.
		However, you may consider using a standard row to better align the
		leading label. Another alternative is to separate the custom area
		with a titled separator.<p>
		
		The Forms tutorial contains the <tt>DefaultFormWithCustomAreasExample</tt>
		that demonstrates three approaches for appending a custom area at the bottom
		of a form.
		These differ in the position of the leading label, the alignment 
		of font baselines and the way the area is separated from the rest.
		

		<h2><a name="2.5">2.5 - How can I identify and understand layout problems?</a></h2>

		Forms ships with two classes that help you debug layouts:
		<tt>FormDebugPanel</tt> paints the layout grid and helps you understand
		how you have specified the layout grid and positioned the components
		in the grid.
		Class <tt>FormDebugUtils</tt> dumps detailed information about the
		grid, groups, component cell positions, component cell constraints, 
		component positions, and container size.<p>
		
		The Forms tutorial contains the <tt>FormDebugExample</tt> that demonstrates
		how to use these two classes.
		
		
		<h2><a name="2.6">2.6 - How can I remove a component from the layout?</a></h2>

		You don't remove a component from layout but from the layout container.
		The container holds a list of layout components. Often the container
		is a <tt>JPanel</tt> or a JPanel subclass.
		To remove a component from the container invoke <tt>Container#remove</tt>.
		You can remove all components using <tt>Container#removeAll</tt>.
		
		
	<p>&nbsp;<br>
	
	<h1>:: 3. Understanding FormLayout ::</h2>
	

		<h2><a name="3.1">3.1 - What does the 'fill' alignment do?</a></h2>

		The horizontal and vertical fill alignments let a component consume 
		all the space in its display area, where the display area is the
		set of cells a component spans. For example a horizontal fill 
		positions the component's left-hand side at the left side of 
		the display area and the component's right-hand side at the right-hand
		side of the display area. 


		<h2><a name="3.2">3.2 - When is it recommended to use the 'pref' size instead of 'default'?</a></h2>

		First off, 'pref'and 'default' differ only if a panel can be resized. 
		As long as there's enough space in the container to give all components 
		their desired preferred sizes, the 'default' size is equal to the 
		'pref' size. This is the case for all packed panels.
		If the panel is then shrinked, the 'pref' size would cut off some
		components, where the 'default' size shrinks them down until
		the minimum size is reached.
		<p>
		To make a layout easier to understand favor 'pref' over 'default' 
		if 'default' adds no value, for example if the panel cannot be resized.
		Otherwise a rule of thumb is to favor 'default' over 'pref' for 
		columns and 'pref' over 'default' for rows. 


		<h2><a name="3.3">3.3 - Why don't components in growing rows fill the vertical space?</a></h2>

		Forms has been designed to reduce the layout code for frequently used layouts.
		I've found that the bulk of form-oriented panels requires components to be
		filled horizontally and centered vertically. These settings are 
		the defaults for the column and row alignments. 
		
		<p>
		If you want a component fill the vertical space, you can configure
		the row or the component's cell constraints. If you want all components
		in a row fill the space, use a <i>fill</i> alignment: 
		<tt>fill:&lt;size&gt;:&lt;growing&gt;</tt>. 
		If you want a component fill the space, use an extended
		cell constraint specification: <tt>cc.xy(3, 1, "fill, fill")</tt>
		where the second <tt>fill</tt> is responsible for filling the vertical space.
		
		<p>
		See also class <tt>VerticalGrowthExample</tt> in the Forms tutorial sources.
		

		<h2><a name="3.4">3.4 - Why don't components that span multiple columns affect the column widths?</a></h2>

		Components that span multipe columns/rows are excluded from 
		the computation of the column widths and row heights respectively.
		I couldn't find an appropriate algorithm how to expand the columns/rows 
		if a large component spans them; either the algorithm leads to good layout 
		but is difficult to understand, or it's easy to understand but 
		leads to poor layout.<p>
		
		If a component must expand the columns or rows it must be in 
		a single column. If necessary, you can move the columns/rows
		it spans to a sublayout.<p>
		
		If you want such components affect the spanned columns/rows, 
		specify that they shall grow. See also the next question.
		

		<h2><a name="3.5">3.5 - Why do components that span multiple columns affect the container width?</a></h2>
		
		Unlike the column expansion mentioned in the previous question,
		it is quite easy to let components that span multipe columns/rows
		grow the container width or height respectively. 
		This way it is guaranteed that such components are fully contained
		if you pack the container.
		

		<h2><a name="3.6">3.6 - Why do some text areas grow but never shrink again?</a></h2>
		
		In some configurations the JTextArea shows an unexpected sizing behavior.
		It then computes its minimum and preferred sizes based on 
		the size previously set by the layout manager or application code.
		Find below information what happens, which configurations are affected,
		and how to setup the text area and layout properly. Some of the
		combinations mentioned below are demonstrated in the pitfalls section
		of the Forms tutorial, see class <tt>GrowingTextAreaExample</tt>.
		
		<p>
		An example of such an ever-growing area is a JTextArea with line wrap enabled, 
		put into a growing FormLayout column ('fill:pref:grow') of a resizable panel. 
		If the panel is layed out the layout manager computes the position
		and size for each component. Every component has then a size set.
		Lets say the area has an initial size of (100,&nbsp;32).
		Now if you make the panel wider, the growing column will assign
		a large width to the area, let's say (150,&nbsp;32). Since then the
		column won't shrink below 150 pixel. Why? The area's preferred size
		is now (150,&nbsp;32), more generally in this configuration the area's 
		minimum and preferred sizes is the size set previously.
		Since the preferred width is 150, the FormLayout will use a minimum
		of 150 for the area's column - still allowing it to grow.
		If you make the panel even wider, the FormLayout will set an even
		larger size to the text area, let's say (200,&nbsp;32). 
		The area's column then won't shrink below 200, because the area's 
		preferred width now increased to 200.
		
		<p>
		To handle this situation you can a) change the layout specification,
		b) change the JTextArea configuration, or c) use a different JTextArea
		preferred size computation.
		
		<p>
		A) A simple way to avoid this resize problem is to use a constant
		column or row size, for example '150dlu' or for growing columns/rows
		'fill:150dlu:grow', where 150dlu is the initial size that can grow.
		Since the dialog units are based on the dialog font this is an 
		appropriate sizing unit and layout specification. It works with
		all JTextArea configuration, regardless wether the area is wrapped
		by a JScrollPane or not.
		
		<p>
		B) Some JTextArea configurations do not compute the minimum and
		preferred size based on the size set previously. For example 
		if you have hand-wrapped text (using '\n') and disable the
		line wrap feature, the minimum and preferred sizes are constant.
		You can put such areas in columns and row specified with 'pref'.
		Another alternative is to give the text area a custom minimum size
		and specify the column or row as 'default' or 'fill:default:grow'.
		Since the 'default' size can shrink a column/row down to its
		minimum width/height, this approach avoids the ever-growing case too.
		However, the minimum size must be specified in pixel and 
		typically in screen design you should favor non-pixel sizes.
		
		<p>
		C) If you put a JTextArea in a JScrollPane the preferred size
		used for the scrollable view can be based on the area's #columns 
		and #rows properties. For example if you use <tt>area.setColumns(40)</tt>
		the scrollpane will have a width of about 40 characters. 
		Another approach is to implement a JTextArea subclass
		or a custom TextAreaUI to compute the preferred size independent
		of the area's size.
		
		<p>
		Why doesn't this happen with the BorderLayout?
		Layout managers have two tasks: they must layout components in a 
		container and must compute the container's minimum, preferred 
		and maximum size.
		BorderLayout honors the content's preferred size when computing
		the container's preferred size. But it ignores the component's
		preferred size when it lays out the container. If you put
		a JTextArea in a BorderLayout center, the whole container has 
		the same preferred size as the text area. If you shrink the container,
		the BorderLayout ignores the text area's preferred size and
		it ignores even its minimum size. Hence it will shrink down 
		the container even below the area's minimum size.



	</td>
	</tr>
	</table>

        <!-- ************ Ende des Inhalts ************************************** -->
	</div>
    </td>
</tr>

<tr>
    <td nowrap="nowrap" bgcolor="F4f3f3">
      <div style="font-size: 10px; margin-left: 17px; margin-top: 20px; margin-right: 10px; margin-bottom: 4px;">
      (c) 2004 JGoodies
      </div>
    </td>
    <td width="1" bgcolor="E7E5E5"></td>
    <td>&nbsp;</td>
</tr>
<tr>
    <td colspan="2" height="1" bgcolor="E7E5E5"></td>
    <td></td>
</tr>

</table>

</body>
</html>