本文整理汇总了Java中com.codename1.components.MultiButton类的典型用法代码示例。如果您正苦于以下问题:Java MultiButton类的具体用法?Java MultiButton怎么用?Java MultiButton使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MultiButton类属于com.codename1.components包,在下文中一共展示了MultiButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addPeople
import com.codename1.components.MultiButton; //导入依赖的package包/类
private void addPeople(Container c) {
c.removeAll();
Resources r = fetchResourceFile();
for(int iter = 0 ; iter < C_NAMES.length ; iter++) {
MultiButton mb = new MultiButton();
mb.setEmblem(null);
mb.setHorizontalLayout(true);
mb.setTextLine1(C_NAMES[iter]);
mb.setTextLine2(C_DATE[iter]);
mb.setTextLine3(C_LINE1[iter]);
mb.setTextLine4(C_LINE2[iter]);
mb.setMaskName("maskImage");
mb.setIconUIID("Avatar");
mb.setIcon(r.getImage(C_AVATAR[iter]));
final int current = iter;
mb.setCommand(new Command("") {
public void actionPerformed(ActionEvent ev) {
selectedOffset = current;
showForm("Person", null);
}
});
c.addComponent(mb);
}
}
示例2: beforeMain
import com.codename1.components.MultiButton; //导入依赖的package包/类
@Override
protected void beforeMain(Form f) {
Image icon = fetchResourceFile().getImage("shai_100x125.jpg");
imageWidth = icon.getWidth();
imageHeight = icon.getHeight();
Container tasksContainer = findTasksContainer(f);
tasksContainer.removeAll();
todos = (Vector<Hashtable<String,String>>)Storage.getInstance().readObject("todos");
if(todos == null) {
todos = new Vector<Hashtable<String,String>>();
return;
}
for(Hashtable<String,String> entry : todos) {
MultiButton mb = createEntry(entry);
tasksContainer.addComponent(mb);
}
}
示例3: onMain_AddTaskButtonAction
import com.codename1.components.MultiButton; //导入依赖的package包/类
@Override
protected void onMain_AddTaskButtonAction(Component c, ActionEvent event) {
TextField title = findTitleField(c.getParent());
TextField description = findDescriptionField(c.getParent());
Hashtable<String, String> entry = new Hashtable<String, String>();
entry.put("title", title.getText());
entry.put("description", description.getText());
if(photo != null) {
entry.put("photo", photo);
}
title.setText("");
description.setText("");
findCaptureButton(c.getParent()).setIcon(null);
MultiButton mb = createEntry(entry);
photo = null;
todos.add(entry);
Storage.getInstance().writeObject("todos", todos);
findTabs1(c.getParent()).setSelectedIndex(0);
Container tasksContainer = findTasksContainer(c.getParent());
tasksContainer.addComponent(mb);
tasksContainer.animateLayout(500);
}
示例4: setMaterialIcon
import com.codename1.components.MultiButton; //导入依赖的package包/类
/**
* Helper method that generalizes icon setting code for various component types
* @param cmp the component, currently supports Labels, MultiButton & SpanButton. If the type isn't supported
* this method return false
* @param icon the material icon
* @param size the size of the icon
* @return false if the type isn't supported
*/
public static boolean setMaterialIcon(Component cmp, char icon, float size) {
if(cmp instanceof Label) {
setMaterialIcon((Label)cmp, icon, size);
return true;
}
if(cmp instanceof MultiButton) {
setMaterialIcon((MultiButton)cmp, icon, size);
return true;
}
if(cmp instanceof SpanButton) {
setMaterialIcon((SpanButton)cmp, icon, size);
return true;
}
return false;
}
示例5: showFavs
import com.codename1.components.MultiButton; //导入依赖的package包/类
/**
* Shows the favorites screen
*/
void showFavs() {
final Form favsForm = new Form("Favourites");
addBackToHome(favsForm);
favsForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
if(favoritesList.size() == 0) {
favsForm.addComponent(new SpanLabel("You have not added any properties to your favourites"));
} else {
// this is really trivial we just take the favorites and show them as a set of buttons
for(Map<String, Object> c : favoritesList) {
MultiButton mb = new MultiButton();
final Map<String, Object> currentListing = c;
String thumb_url = (String)currentListing.get("thumb_url");
String guid = (String)currentListing.get("guid");
String price_formatted = (String)currentListing.get("price_formatted");
String summary = (String)currentListing.get("summary");
mb.setIcon(URLImage.createToStorage(placeholder, guid, thumb_url, URLImage.RESIZE_SCALE_TO_FILL));
mb.setTextLine1(price_formatted);
mb.setTextLine2(summary);
mb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
showPropertyDetails(favsForm, currentListing);
}
});
favsForm.addComponent(mb);
}
}
favsForm.show();
}
示例6: createContactComponent
import com.codename1.components.MultiButton; //导入依赖的package包/类
private MultiButton createContactComponent(ContactData d) {
MultiButton mb = new MultiButton();
mb.putClientProperty("uid", d.uniqueId);
mb.setTextLine1(d.name);
if(d.imageUrl != null) {
mb.setIcon(URLImage.createToStorage(userPlaceholder, "userPic" + d.uniqueId, d.imageUrl, URLImage.RESIZE_SCALE_TO_FILL));
} else {
mb.setIcon(userPlaceholder);
}
mb.addActionListener((e) -> {
showChatForm(d, mb);
});
return mb;
}
示例7: createRendererMultiButton
import com.codename1.components.MultiButton; //导入依赖的package包/类
private MultiButton createRendererMultiButton() {
MultiButton b = new MultiButton();
b.setIconName("icon");
b.setNameLine1("fname");
b.setNameLine2("phone");
b.setUIID("Label");
return b;
}
示例8: createGridRenderer
import com.codename1.components.MultiButton; //导入依赖的package包/类
protected CellRenderer createGridRenderer() {
MultiButton sel = createRendererMultiButton();
MultiButton unsel = createRendererMultiButton();
sel.setIconPosition(BorderLayout.NORTH);
unsel.setIconPosition(BorderLayout.NORTH);
return new GenericListCellRenderer(sel, unsel);
}
示例9: createEntry
import com.codename1.components.MultiButton; //导入依赖的package包/类
private MultiButton createEntry(final Hashtable<String, String> entry) {
final MultiButton mb = new MultiButton();
mb.setCheckBox(true);
mb.setTextLine1((String)entry.get("title"));
mb.setTextLine2((String)entry.get("description"));
String photo = (String)entry.get("photo");
if(photo != null) {
try {
mb.setIcon(Image.createImage(Storage.getInstance().createInputStream(photo)));
} catch (IOException ex) {
Log.e(ex);
}
} else {
String photoURL = (String)entry.get("photoURL");
if(photoURL != null) {
ImageDownloadService.createImageToStorage(photoURL, mb.getIconComponent(),
(String)entry.get("title"), new Dimension(imageWidth, imageHeight));
}
}
mb.setEmblem(null);
mb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
Container parent = mb.getParent();
parent.removeComponent(mb);
parent.animateLayout(500);
todos.remove(entry);
Storage.getInstance().writeObject("todos", todos);
logEntryRemoved(entry);
}
});
return mb;
}
示例10: onMain_ImportJSONAction
import com.codename1.components.MultiButton; //导入依赖的package包/类
@Override
protected void onMain_ImportJSONAction(final Component c, ActionEvent event) {
ConnectionRequest cr = new ConnectionRequest() {
protected void readResponse(InputStream is) throws IOException {
JSONParser p = new JSONParser();
Hashtable h = p.parse(new InputStreamReader(is));
Hashtable<Object, Hashtable<String, String>> todoHash = (Hashtable<Object, Hashtable<String, String>>)h.get("todo");
Container tasksContainer = findTasksContainer(c.getParent());
for(Hashtable<String, String> values : todoHash.values()) {
String photoURL = values.get("photoURL");
String title = values.get("title");
MultiButton mb = createEntry(values);
todos.add(values);
tasksContainer.addComponent(mb);
if(photoURL != null) {
ImageDownloadService.createImageToStorage(photoURL, mb.getIconComponent(),
title, new Dimension(imageWidth, imageHeight));
}
}
Storage.getInstance().writeObject("todos", todos);
findTabs1(c.getParent()).setSelectedIndex(0);
tasksContainer.animateLayout(500);
}
};
InfiniteProgress i = new InfiniteProgress();
Dialog blocking = i.showInifiniteBlocking();
cr.setDisposeOnCompletion(blocking);
cr.setPost(false);
cr.setUrl("https://dl.dropbox.com/u/57067724/cn1/Course%20Material/webservice/NetworkingChapter.json");
NetworkManager.getInstance().addToQueue(cr);
}
示例11: MultiList
import com.codename1.components.MultiButton; //导入依赖的package包/类
/**
* Constructor for the GUI builder
*/
public MultiList() {
super(new DefaultListModel(new Object[] {
h("Entry 1", "more..."),
h("Entry 2", "more..."),
h("Entry 3", "more..."),
}));
sel = new MultiButton();
unsel = new MultiButton();
}
示例12: createListRenderer
import com.codename1.components.MultiButton; //导入依赖的package包/类
protected ListCellRenderer createListRenderer() {
MultiButton sel = createRendererMultiButton();
MultiButton unsel = createRendererMultiButton();
return new GenericListCellRenderer(sel, unsel);
}
示例13: onMain_ImportXMLAction
import com.codename1.components.MultiButton; //导入依赖的package包/类
@Override
protected void onMain_ImportXMLAction(final Component c, ActionEvent event) {
ConnectionRequest cr = new ConnectionRequest() {
protected void readResponse(InputStream is) throws IOException {
Container tasksContainer = findTasksContainer(c.getParent());
XMLParser p = new XMLParser();
Element elem = p.parse(new InputStreamReader(is));
int childCount = elem.getNumChildren();
for(int iter = 0 ; iter < childCount ; iter++) {
Element current = elem.getChildAt(iter);
String title = current.getAttribute("title");
Hashtable values = new Hashtable();
values.put("title", title);
values.put("description", current.getAttribute("description"));
String photoURL = current.getAttribute("photourl");
if(photoURL != null) {
values.put("photoURL", photoURL);
}
MultiButton mb = createEntry(values);
todos.add(values);
tasksContainer.addComponent(mb);
if(photoURL != null) {
ImageDownloadService.createImageToStorage(photoURL, mb.getIconComponent(),
title, new Dimension(imageWidth, imageHeight));
}
}
Storage.getInstance().writeObject("todos", todos);
findTabs1(c.getParent()).setSelectedIndex(0);
tasksContainer.animateLayout(500);
}
};
InfiniteProgress i = new InfiniteProgress();
Dialog blocking = i.showInifiniteBlocking();
cr.setDisposeOnCompletion(blocking);
cr.setPost(false);
cr.setUrl("https://dl.dropbox.com/u/57067724/cn1/Course%20Material/webservice/NetworkingChapter.xml");
NetworkManager.getInstance().addToQueue(cr);
}
示例14: createListRenderer
import com.codename1.components.MultiButton; //导入依赖的package包/类
private ListCellRenderer createListRenderer() {
MultiButton sel = createRendererMultiButton();
MultiButton unsel = createRendererMultiButton();
return new GenericListCellRenderer(sel, unsel);
}
示例15: getSelectedButton
import com.codename1.components.MultiButton; //导入依赖的package包/类
/**
* Allows developers to customize the properties of the selected multi-button in code
* @return the selected multi button
*/
public MultiButton getSelectedButton() {
return sel;
}