Chapter 3 - Code Snippets
=========================
p. 120, Modify the Java Code:
Step 2. Add one line of code under the "JScrollPane masterScroller = new JScrollPane();" line in the BC4J binding variable section:
private LocPanel locPanel;
Step 3. Add the following 2 lines of code to the jbInit()method section under the "this.add(masterScroller, BorderLayout.NORTH);" line:
locPanel = new LocPanel(panelBinding);
masterScroller.getViewport().add(locPanel);
}
----------------------------------------------------------------------------------
p. 124:
Step 11. Under the BC4J binding variable comment, after the “private JScrollPane detailScroller = new JScrollPane();” line, add the following code:
private DeptPanel deptPanel;
Step 12. In the jbInit()method, under “locPanel = new LocPanel(panelBinding);” insert a blank line and add the following code:
deptPanel = new DeptPanel(panelBinding);
Step 13. Also in the jbInit() method, under “masterScroller.getViewport().add(LocPanel);” insert a blank line and add the following code:
detailScroller.getViewport().add(deptPanel);
----------------------------------------------------------------------------------
p. 127, Change the Column Widths and Headings:
Step 3. Find the jbInit() method by double clicking the method named in the Structure Window (it is at approximately line 49)
and add these four lines of code under the “this.add(dataPanel, BorderLayout.CENTER);” line:
deptViewTable.getColumn("DepartmentId").setMaxWidth(60);
deptViewTable.getColumn("DepartmentId").setHeaderValue("ID");
deptViewTable.getColumn("DepartmentName").setMaxWidth(200);
deptViewTable.getColumn("DepartmentName").setHeaderValue("Department");
-------------------------------------------------------------------------------------------------------------------
p. 132, Step 1:
1. Add the following line in the heading section after the tag:
------------------------------------------------------------------------------------------------------------------