Java Reference
In-Depth Information
private ImageIcon iconProduct1 #
new ImageIcon("Product1.jpg");
private GridBagLayout gridBagLayout1 #
new GridBagLayout();
//...
private BarCodeListener listener;
public void setListener(BarCodeListener newListener){
listener # newListener;
}
void readCode_actionPerformed(ActionEvent e) {
if (listener! # null){
String cmd # e.getActionCommand();
listener.readValue( new BarCodeReaderEvent(cmd));
}
}
}
14.4.4
Test
The test on the user interface consists of a set of operations that correspond
to user touches on the terminal screen. The sequence of operations and
expected effects on the user interface are:
Run the terminal program:
-
The terminal starts with the initial screen (Figure 14.6, top).
Select the “code” field and type “1” on the keypad.
Select the “password” field and type “111” on the keypad.
Click on the “Connect” button:
-
the terminal switches to the Acquisition screen (Figure 14.6, bottom);
-
the bar code reader emulation window appears.
Simulate the reading of the code of a customer by clicking on one of the
customer bar codes:
-
the terminal window shows the name of the customer.
Simulate the reading of a product code:
-
the terminal window shows the name and the price of the product.
Simulate the reading of another product code:
-
the “Check” area contains the first product with quantity equal to 1;
-
the total is incremented by the price of product 1;
-
the terminal window shows the name and the price of the second
product;
Select the “Quantity” field, type on the “C” button of the keypad and then
on the “2” button.
Click on the “End” button:
-
the “Check” area contains the list of the two products with the relative
quantities and the total;
-
the customer name has been erased;
-
the total has been reset to 0.
 
Search WWH ::




Custom Search