I can get a simple horizontal list now. My purpose is design the MainView like the below picture.
Code MainView.java
public class MainView extends Container {
private HomeInfoReponse homeInfo;
private Resources resource;
private Container north, center, south;
private ChartView chartView;
private List lst = new List();
public MainView(HomeInfoReponse h) {
super(new BorderLayout());
this.homeInfo = h;
}
@Override
protected void initComponent() {
this.removeAll();
north = new Container(new FlowLayout());
center = new Container(new BorderLayout());
south = new Container(new BorderLayout());
// init a Chart
ChartBuilder b = new ChartBuilder();
final Chart chart = b.newBarChart(
new double[][]{
{4, 19, 21, 15},
{3, 18, 26, 47},
{37, 24, 11, 16},
{21, 32, 24, 41}
},
new String[]{"BC", "Alberta", "Ontario", "Saskatchewan"},
new String[]{"June", "July", "August", "Sept"}
);
chartView = new ChartView(chart);
chartView.setScrollable(false);
chartView.initLater();
// chartView.update();
this.removeComponent(chartView);
this.removeComponent(lst);
south.addComponent(BorderLayout.CENTER, chartView);
south.setSize(new Dimension(500, 500));
// init a horizontal list
String items[] = {"Jan", "Feb", "Mar", "Apr", "May"};
lst.setModel(new DefaultListModel(items));
lst.setOrientation(List.HORIZONTAL);
lst.setFixedSelection(List.FIXED_NONE_CYCLIC);
center.addComponent(BorderLayout.CENTER, lst);
this.addComponent(BorderLayout.SOUTH, south);
this.addComponent(BorderLayout.CENTER, center);
this.addComponent(BorderLayout.NORTH, north);
}
}