看了JSplitPane源代码后,自己已经解决!
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;public class SplitTest extends JFrame
{
public SplitTest()
{
super("SplitFrame Test");
init();
}

public void init()
{

Container c = getContentPane();
JTree tree = new JTree();
JPanel panel1 = new JPanel();
panel1.setBackground(Color.white);
JSplitPane centerPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,tree,panel1);

centerPane.setContinuousLayout(true);
centerPane.setOneTouchExpandable(true);

JPanel panel2 = new JPanel();
panel2.setBackground(Color.red);



JSplitPane mainPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,panel2,centerPane);
mainPane.setContinuousLayout(true);




c.add(mainPane,"Center");

this.setDefaultCloseOperation(3);

this.setSize(800,600);

this.show();


//======================================此处无效

centerPane.setDividerLocation(0.2);

//======================================

//======================================此处无效

mainPane.setDividerLocation(0.2);

//======================================

this.repaint();
}


public static void main(String args[])
{
new SplitTest();
}


}