If the symbol variable gets re-assigned each time the user adds a
stock, I would assume that the symbol variable contains the value of
the most recently added stock. But it doesn't because the removeButton
knows which stock to remove - regardless of what was added last. the
variables symbol and removedIndex are different for each instance of
the removeButton. Why is this?
//the symbol variable is assigned here:
final String symbol = newSymbolTextBox.getText().toUpperCase().trim();
//yet symbol and removedIndex contain a different value for each
removeButton indicated below. Why?
removeStockButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
int removedIndex = stocks.indexOf(symbol);//why doesn't symbol contain
the last stock added?
stocks.remove(removedIndex);
stocksFlexTable.removeRow(removedIndex + 1);
}
});
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.