Client-Side Presentation Logic
603
The remainder of the init() methods code sets up the AWT user interface, and obtains the
mincomm parameter:
destGroup = new CheckboxGroup();
allClick = new Checkbox("All Deals");
allClick.addItemListener(this);
allClick.setCheckboxGroup(destGroup);
mexicoClick = new Checkbox("Mexico");
mexicoClick.addItemListener(this);
mexicoClick.setCheckboxGroup(destGroup);
caribClick = new Checkbox("Caribbean");
caribClick.addItemListener(this);
caribClick.setCheckboxGroup(destGroup);
hawaiiClick = new Checkbox("Hawaii");
hawaiiClick.addItemListener(this);
hawaiiClick.setCheckboxGroup(destGroup);
destGroup.setSelectedCheckbox(allClick);
listNeedUpdate = true;
tripList = new List();
tripList.setSize(LISTWIDTH, LISTHEIGHT);
myFont = new Font("SansSerif", Font.PLAIN, FONTSIZE);
tripList.setFont(myFont);
updateButton = new Button("Update");
updateButton.addActionListener(this);
clickPanel = new Panel();
clickPanel.setLayout(new FlowLayout());
clickPanel.add(allClick);
clickPanel.add(hawaiiClick);
clickPanel.add(mexicoClick);
clickPanel.add(caribClick);
clickPanel.add(updateButton);
setLayout(new BorderLayout());
add("Center", tripList);
add("North", clickPanel);
String tpComm = getParameter("mincomm");
minCommission = Integer.parseInt(tpComm, 10);
}
The locateDealsXML() method is a wrapper method for hiding the details of the HTTP GET
transaction. If we assume that the applet is on the localhost at port 8080, the URL that it creates the GET
transaction is:
http://localhost:8080/vacserv/servlet/locatedeals?tnum=nnn