• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MultiButton类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.codename1.components.MultiButton的典型用法代码示例。如果您正苦于以下问题:Java MultiButton类的具体用法?Java MultiButton怎么用?Java MultiButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MultiButton类属于com.codename1.components包,在下文中一共展示了MultiButton类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
    }
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:25,代码来源:StateMachine.java


示例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);
    }
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:18,代码来源:StateMachine.java


示例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);
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:23,代码来源:StateMachine.java


示例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 &amp; 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;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:24,代码来源:FontImage.java


示例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();
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:32,代码来源:PropertyCross.java


示例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;
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:15,代码来源:SocialChat.java


示例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;
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:9,代码来源:Contacts.java


示例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);
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:8,代码来源:Contacts.java


示例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;
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:33,代码来源:StateMachine.java


示例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);
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:35,代码来源:StateMachine.java


示例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();
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:13,代码来源:MultiList.java


示例12: createListRenderer

import com.codename1.components.MultiButton; //导入依赖的package包/类
protected ListCellRenderer createListRenderer() {
    MultiButton sel = createRendererMultiButton();
    MultiButton unsel = createRendererMultiButton();
    return new GenericListCellRenderer(sel, unsel);
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:6,代码来源:Contacts.java


示例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);
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:42,代码来源:StateMachine.java


示例14: createListRenderer

import com.codename1.components.MultiButton; //导入依赖的package包/类
private ListCellRenderer createListRenderer() {
    MultiButton sel = createRendererMultiButton();
    MultiButton unsel = createRendererMultiButton();
    return new GenericListCellRenderer(sel, unsel);
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:6,代码来源:EmailShare.java


示例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;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:8,代码来源:MultiList.java


示例16: getUnselectedButton

import com.codename1.components.MultiButton; //导入依赖的package包/类
/**
 * Allows developers to customize the properties of the unselected multi-button in code
 * @return the unselected multi button
 */
public MultiButton getUnselectedButton() {
    return unsel;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:8,代码来源:MultiList.java



注:本文中的com.codename1.components.MultiButton类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Coordinate类代码示例发布时间:2022-05-16
下一篇:
Java GCInspectorMXBean类代码示例发布时间:2022-05-16
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap