Oliver said:
When I work for someone else, whatever they decide to use (be it
Swing, SWT or anything else), that's what I have to use.
When I'm working on my own personal projects though, they tend to be
small, and if I plan on distributing them, I don't want to inflate the
size by including lots of JARs. When I'm writing for the "plain" Java
platform, I use Swing, and when I'm writing for the Eclipse platform, I
use SWT.
All of the above is assuming that I were JGoodies were available for
me to use for free; but from what I understand, you have to pay a
license to use it ($885 USD for 1 developer, 1 year?).
I guess I just haven't looked at JGoodies yet because I don't know
what problem it would solve for me that would be worth the extra JAR(s),
and the money.
- Oliver
Naturally, the client dictates what layout manager is used. If they know
what their requirements dictate.
No, actually they have a free version for their Forms, Looks, Animation,
Binding and Validation. The product, at cost, is their Swing Suite. All
come with extensive examples and api docs, even though freeware.
You can get the free libs at:
http://www.jgoodies.com/freeware
As to size this is what it works out to if you want to use any
particular one of them:
Forms 84k
Looks 359k
Animation 54k
Binding 159k
Validation 45k
Here is a program as an example of what it would look like. I used it to
model a layout I was testing. Forms provides you four ways(Classes) to
build you GUI. I took this path.
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import javax.swing.border.BevelBorder;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.debug.FormDebugPanel;
import com.jgoodies.forms.debug.FormDebugUtils;
import com.jgoodies.forms.factories.Borders;
import com.jgoodies.forms.factories.ButtonBarFactory;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.RowSpec;
public class InsertModel {
protected static final boolean DEBUGMODE = false;
static private JFrame frame = new JFrame();
private JLabel jLabel1 = new JLabel();
private JLabel jLabel2 = new JLabel();
private JLabel jLabel3 = new JLabel();
private JTextField jTextField1 = new
JTextField();
private JTextField jTextField2 = new
JTextField();
private JTextField jTextField3 = new
JTextField();
private JTextField jTextField4 = new
JTextField();
private JTextField jTextField5 = new
JTextField();
private JTextField jTextField6 = new
JTextField();
private JTextField jTextField7 = new
JTextField();
private JTextField jTextField8 = new
JTextField();
private JTextField jTextField9 = new
JTextField();
private JTextArea jTextArea1 = new JTextArea();
private JTextArea jTextArea2 = new JTextArea();
private JTextArea jTextArea3 = new JTextArea();
private JComboBox JComboAuthorlist = new JComboBox();
private final String LABEL = "JLabel( )";
private final String BUTTON = "JButton";
private final String TEXTAREA = "JTextArea( )";
private final String TEXTFIELD = "JTextField( )";
private final String EMPTY = "";
private final Integer JSPLIT_DIV_LOC = 396;
public InsertModel() {
}
public void start_InsertModel() {
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.getContentPane().add(buildMainPanel(),BorderLayout.CENTER);
frame.getContentPane().add(buildStatusPanel(),BorderLayout.PAGE_END);
try { UIManager.setLookAndFeel( new
com.incors.plaf.kunststoff.KunststoffLookAndFeel());
} catch (Exception e) { }
SwingUtilities.updateComponentTreeUI(frame);
frame.pack();
frame.setVisible(true);
}
public static void main(String[] args) {
InsertModel instance = new InsertModel();
instance.start_InsertModel();
}
protected JComponent buildMainPanel() {
JComponent topComponent = buildTopPanel();
JComponent botComponent = buildBottomPanel();
JSplitPane splitPane = new JSplitPane(
JSplitPane.VERTICAL_SPLIT,
true,
topComponent,botComponent);
splitPane.setDividerLocation(JSPLIT_DIV_LOC);
splitPane.setContinuousLayout(true);
splitPane.setBorder(Borders.DIALOG_BORDER);
splitPane.setOneTouchExpandable(true);
return splitPane;
}
private JComponent buildTopPanel() {
FormLayout layout = new FormLayout(
"12dlu, right
ref, 6dlu, 50dlu, 6dlu, 50dlu, 6dlu, " +
"right:35dlu, 6dlu, left:50dlu, 6dlu, right:50dlu," +
"6dlu, left:50dlu, 6dlu, fill:default:grow",
""); // add rows dynamically
DefaultFormBuilder builder = DEBUGMODE
? new DefaultFormBuilder(layout,new FormDebugPanel())
: new DefaultFormBuilder(layout);
builder.setDefaultDialogBorder();
builder.setRowGroupingEnabled(true);
builder.setLeadingColumnOffset(1);
CellConstraints cc = new CellConstraints();
builder.appendSeparator("Separator 1");
builder.append(LABEL,buildControl(jTextField1,TEXTFIELD),3);
builder.append(LABEL,buildControl(jLabel1,LABEL));
builder.append(LABEL,buildControl(jLabel2,LABEL));
builder.nextLine();
builder.append(LABEL,JComboAuthorlist,7);
builder.nextLine();
builder.appendSeparator("Separator 2");
builder.append(LABEL,buildControl(jTextField2,TEXTFIELD),3);
builder.append(LABEL,buildControl(jLabel3,LABEL));
builder.nextLine();
builder.append(LABEL,buildControl(jTextField3,TEXTFIELD),5);
builder.nextLine();
builder.append(LABEL,buildControl(jTextField4,TEXTFIELD),5);
builder.nextLine();
builder.append(LABEL,buildControl(jTextField5,TEXTFIELD),5);
builder.nextLine();
builder.append(LABEL,buildControl(jTextField6,TEXTFIELD),3);
builder.nextLine();
builder.append(LABEL,buildControl(jTextField7,TEXTFIELD));
builder.nextLine();
builder.append(LABEL,buildControl(jTextField8,TEXTFIELD),7);
builder.nextColumn(-2 );
builder.append(EMPTY,buildButton(BUTTON),1);
builder.appendRow(builder.getLineGapSpec());
builder.appendRow(new RowSpec("fill:41dlu:grow"));
builder.nextLine(2);
builder.append(LABEL);
builder.add(buildControl(jTextArea1,TEXTAREA),cc.xyw(builder
.getColumn(),builder.getRow(),13));
builder.appendRow(builder.getLineGapSpec());
if (DEBUGMODE) FormDebugUtils.dumpAll(builder.getPanel());
return builder.getPanel();
}
private JComponent buildBottomPanel(){
FormLayout layout = new FormLayout(
"12dlu, right
ref, 6dlu, default:grow",
"12dlu, pref, 3dlu, fill:0:grow(0.50), 3dlu," +
"fill:0:grow(0.50), 6dlu, 18dlu");
DefaultFormBuilder builder = DEBUGMODE
? new DefaultFormBuilder(layout,new FormDebugPanel())
: new DefaultFormBuilder(layout);
builder.setDefaultDialogBorder();
builder.setRowGroupingEnabled(true);
builder.setLeadingColumnOffset(1);
builder.appendSeparator("Separator 3");
builder.nextLine(3);
builder.append(LABEL,buildControl(jTextArea2,TEXTAREA));
builder.nextLine(2);
builder.append(LABEL,buildControl(jTextArea3,TEXTAREA));
builder.nextLine(2);
builder.nextColumn(2);
builder.append(ButtonBarFactory.buildCenteredBar(buildButton(BUTTON),buildButton(BUTTON)));
if (DEBUGMODE) FormDebugUtils.dumpAll(builder.getPanel());
return builder.getPanel();
}
private JComponent buildStatusPanel() {
jTextField9 = buildControl(jTextField9,TEXTFIELD);
jTextField9.setFont(new Font("Dialog",1,12));
jTextField9.setEditable(false);
jTextField9.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
FormLayout layout = new FormLayout("default:grow","");
DefaultFormBuilder builder = new DefaultFormBuilder(layout);
builder.append(jTextField9);
return builder.getPanel();
}
/*
-----------------------------------------------------------------------------------
* Controls Factories
*
-----------------------------------------------------------------------------------
*/
private JButton buildButton(String labelText){
JButton jButton = new JButton(labelText);
jButton.setName(labelText);
jButton.setActionCommand(labelText);
return jButton;
}
private JLabel buildControl(JLabel jLabel,String label) {
if (DEBUGMODE) jLabel.setText(label);
jLabel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
jLabel.setBackground(Color.black);
return jLabel;
}
private JTextField buildControl(JTextField jTextField,String label) {
if (DEBUGMODE) jTextField.setText(label);
jTextField.setName(label);
jTextField.setForeground(Color.white);
jTextField.setBackground(Color.red);
jTextField.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
jTextField.setDragEnabled(true);
return jTextField;
}
private JScrollPane buildControl(JTextArea jTextArea,String label)
{
if (DEBUGMODE) jTextArea.setText(label);
jTextArea.setName(label);
jTextArea.setForeground(Color.white);
jTextArea.setBackground(Color.blue);
jTextArea.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
jTextArea.setFont(new Font("Dialog",1,11));
jTextArea.setLineWrap(true);
jTextArea.setDragEnabled(true);
return new JScrollPane(jTextArea);
}
}
--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)