import java
/**
* @param args
*/
public static void main(String[] args) {
new Layout
}}class Layout
Layout
this
this
this
JPanel jp = new JPanel()
jp
jp
JPanel p
p
p
p
p
jp
jp
jp
JPanel p
p
p
p
p
jp
jp
jp
jp
MPanel
/*mp
mp
mp
mp
jp
jp
jp
add(jp)
}}class MPanel
MPanel
/*Dimension d = new Dimension(
//this
this
this
add(new JLabel(
this
}}class Constraint extends GridBagConstraints {
Constraint(int gridx
this
this
this
//this
this
}
Constraint(int gridx
this(gridx
//高和寬指物件占用的空間
this
this
}
public Constraint setFill(int fill) {
this
return this;
}
public Constraint setAnchor(int anchor) {
this
//and NORTHWEST
return this;
}
public Constraint setWeight(double weightx
this
this
return this;
}
public Constraint setInsets(int distance){
this
return this;
}}
From:http://tw.wingwit.com/Article/program/Java/hx/201311/26850.html