2
* Copyright (c) 2002-2004 JGoodies Karsten Lentzsch. All Rights Reserved.
2
* Copyright (c) 2002-2008 JGoodies Karsten Lentzsch. All Rights Reserved.
4
* Redistribution and use in source and binary forms, with or without
4
* Redistribution and use in source and binary forms, with or without
5
5
* modification, are permitted provided that the following conditions are met:
7
* o Redistributions of source code must retain the above copyright notice,
8
* this list of conditions and the following disclaimer.
10
* o Redistributions in binary form must reproduce the above copyright notice,
11
* this list of conditions and the following disclaimer in the documentation
12
* and/or other materials provided with the distribution.
14
* o Neither the name of JGoodies Karsten Lentzsch nor the names of
15
* its contributors may be used to endorse or promote products derived
16
* from this software without specific prior written permission.
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7
* o Redistributions of source code must retain the above copyright notice,
8
* this list of conditions and the following disclaimer.
10
* o Redistributions in binary form must reproduce the above copyright notice,
11
* this list of conditions and the following disclaimer in the documentation
12
* and/or other materials provided with the distribution.
14
* o Neither the name of JGoodies Karsten Lentzsch nor the names of
15
* its contributors may be used to endorse or promote products derived
16
* from this software without specific prior written permission.
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
28
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
31
package com.jgoodies.forms.tutorial.building;
36
36
import com.jgoodies.forms.layout.FormLayout;
39
* Uses the FormLayout and the <code>DefaultFormBuilder</code>.
40
* Columns are specified before the panel is filled with components,
41
* rows are added dynamically. The builder is used to hold a cursor,
42
* to add rows dynamically, and to fill components.
39
* Uses the FormLayout and the <code>DefaultFormBuilder</code>.
40
* Columns are specified before the panel is filled with components,
41
* rows are added dynamically. The builder is used to hold a cursor,
42
* to add rows dynamically, and to fill components.
43
43
* The builder's convenience methods are used to add labels and separators.<p>
45
45
* This panel building style is recommended unless you have a more
46
* powerful builder or don't want to add rows dynamically.
47
* See the {@link DynamicRowsExample} for an implementation that specifies
48
* rows before the panel is filled with components.
46
* powerful builder or don't want to add rows dynamically.
47
* See the {@link DynamicRowsExample} for an implementation that specifies
48
* rows before the panel is filled with components.
50
50
* @author Karsten Lentzsch
51
* @version $Revision: 1.8 $
51
* @version $Revision: 1.18 $
53
53
* @see DefaultFormBuilder
54
54
* @see PlainExample
55
55
* @see RowCounterExample
125
125
// Building ***************************************************************
128
* Builds the flange editor panel.
129
* Columns are specified before components are added to the form,
128
* Builds the flange editor panel.
129
* Columns are specified before components are added to the form,
130
130
* rows are added dynamically using the {@link DefaultFormBuilder}.<p>
132
132
* The builder combines a step that is done again and again:
133
133
* add a label, proceed to the next data column and add a component.
135
135
* @return the built panel
137
137
public JComponent buildPanel() {
138
138
initComponents();
140
// Column specs only, rows will be added dynamically.
140
141
FormLayout layout = new FormLayout(
141
"right:max(40dlu;pref), 3dlu, 70dlu, 7dlu, "
142
+ "right:max(40dlu;pref), 3dlu, 70dlu",
142
"right:[40dlu,pref], 3dlu, 70dlu, 7dlu, "
143
+ "right:[40dlu,pref], 3dlu, 70dlu");
144
144
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
145
145
builder.setDefaultDialogBorder();
150
150
builder.append("&Identifier", identifierField);
151
151
builder.nextLine();
153
builder.append("PTI [kW]", ptiField);
154
builder.append("Power [kW]", powerField);
153
builder.append("PTI/kW", ptiField);
154
builder.append("Power/kW", powerField);
156
builder.append("s [mm]", sField);
156
builder.append("s/mm", sField);
157
157
builder.nextLine();
160
160
builder.appendSeparator("Diameters");
162
builder.append("&da [mm]", daField);
163
builder.append("di [mm]", diField);
165
builder.append("da2 [mm]", da2Field);
166
builder.append("di2 [mm]", di2Field);
168
builder.append("R [mm]", rField);
169
builder.append("D [mm]", dField);
162
builder.append("&da/mm", daField);
163
builder.append("di/mm", diField);
165
builder.append("da2/mm", da2Field);
166
builder.append("di2/mm", di2Field);
168
builder.append("R/mm", rField);
169
builder.append("D/mm", dField);
172
172
builder.appendSeparator("Criteria");
174
builder.append("&Location", locationCombo);
174
builder.append("&Location", locationCombo);
175
175
builder.append("k-factor", kFactorField);
177
177
return builder.getPanel();
b'\\ No newline at end of file'