import com.codename1.ui.plaf.Style; //导入方法依赖的package包/类
/**
* Shows the form containing the list of contacts we can chat with
*/
void showContactsForm(UserData data) {
listenToMessages();
Form contactsForm = new Form("Contacts");
contactsForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
// the toolbar is created into a layer on the content pane. This allows us to render behind it and leave it semi transparent
Toolbar tb = new Toolbar(true);
// we want the title area to be transparent so it won't get in the way
contactsForm.getTitleArea().setUIID("Container");
// folds the toolbar automatically as we scroll down, shows it if we scroll back up
tb.setScrollOffUponContentPane(true);
contactsForm.setToolBar(tb);
// we want the image behind the toolbar to stretch and fit the entire screen and leave no margin
Label titleLabel = new Label(" ");
Style titleLabelStyle = titleLabel.getUnselectedStyle();
titleLabelStyle.setBgImage(theme.getImage("social-chat-tutorial-image-top.jpg"));
titleLabelStyle.setBackgroundType(Style.BACKGROUND_IMAGE_SCALED_FILL);
titleLabelStyle.setPadding(tb.getPreferredH(), tb.getPreferredH(), tb.getPreferredH(), tb.getPreferredH());
titleLabelStyle.setPaddingUnit(Style.UNIT_TYPE_PIXELS, Style.UNIT_TYPE_PIXELS, Style.UNIT_TYPE_PIXELS, Style.UNIT_TYPE_PIXELS);
titleLabelStyle.setMargin(0, 0, 0, 0);
contactsForm.addComponent(titleLabel);
// the behavior of the title is rather complex so we extract it to a separate method
tb.setTitleComponent(createTitleComponent(contactsForm));
InfiniteProgress ip = new InfiniteProgress();
contactsForm.addComponent(ip);
loadContacts(data, ip, contactsForm.getContentPane());
// creates the morph and other animations from the main form to the second form of the app
createMorphEffect(titleLabel);
contactsForm.show();
showPendingMessages(contactsForm);
}