FormLayout: Basic Example 1
/*
Code revised from Desktop Java Live:
http://www.sourcebeat.com/downloads/
*/
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
import javax.swing.*;
public class FormLayoutExample1 extends JPanel {
public FormLayoutExample1() {
FormLayout formLayout = new FormLayout("pref", "pref, pref");
setLayout(formLayout);
CellConstraints c = new CellConstraints();
add(new JLabel("Component 1"), c.xy(1, 1));
add(new JLabel("Component 2"), c.xy(1, 2));
}
public static void main(String[] a){
JFrame f = new JFrame("FormLayout: Basic Example 1");
f.setDefaultCloseOperation(2);
f.add(new FormLayoutExample1());
f.pack();
f.setVisible(true);
}
}
jgoodiesFormLayoutReady.zip( 98 k)Related examples in the same category