Search in sources :

Example 1 with MultiButton

use of com.codename1.components.MultiButton in project CodenameOne by codenameone.

the class PreviewInSimulator method main.

/**
 * Called back from simulateDeviceActionPerformed to show the simulator skin
 */
public static void main(String[] argv) {
    com.codename1.ui.Display.init(new Runnable() {

        public void run() {
            try {
                Preferences pref = Preferences.userNodeForPackage(PreviewInSimulator.class);
                String theme = pref.get("previewTheme", null);
                File resFile = new File(pref.get("previewResource", null));
                String baseResDir = pref.get("baseResourceDir", null);
                if (baseResDir != null) {
                    JavaSEPort.setBaseResourceDir(new File(baseResDir));
                }
                String selection = pref.get("previewSelection", null);
                Resources res = Resources.open(new FileInputStream(resFile));
                if (theme == null || theme.length() == 0) {
                    if (com.codename1.ui.Display.getInstance().hasNativeTheme()) {
                        com.codename1.ui.Display.getInstance().installNativeTheme();
                    }
                } else {
                    com.codename1.ui.plaf.UIManager.getInstance().setThemeProps(res.getTheme(theme));
                }
                com.codename1.ui.util.UIBuilder.registerCustomComponent("Table", com.codename1.ui.table.Table.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("MediaPlayer", com.codename1.components.MediaPlayer.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("ContainerList", com.codename1.ui.list.ContainerList.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("ComponentGroup", com.codename1.ui.ComponentGroup.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("Tree", com.codename1.ui.tree.Tree.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("HTMLComponent", com.codename1.ui.html.HTMLComponent.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("RSSReader", com.codename1.components.RSSReader.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("FileTree", com.codename1.components.FileTree.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("WebBrowser", com.codename1.components.WebBrowser.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("NumericSpinner", com.codename1.ui.spinner.NumericSpinner.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("DateSpinner", com.codename1.ui.spinner.DateSpinner.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("TimeSpinner", com.codename1.ui.spinner.TimeSpinner.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("DateTimeSpinner", com.codename1.ui.spinner.DateTimeSpinner.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("GenericSpinner", com.codename1.ui.spinner.GenericSpinner.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("LikeButton", com.codename1.facebook.ui.LikeButton.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("InfiniteProgress", com.codename1.components.InfiniteProgress.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("MultiButton", com.codename1.components.MultiButton.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("SpanButton", com.codename1.components.SpanButton.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("SpanLabel", com.codename1.components.SpanLabel.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("Ads", com.codename1.components.Ads.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("MapComponent", com.codename1.maps.MapComponent.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("MultiList", com.codename1.ui.list.MultiList.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("ShareButton", com.codename1.components.ShareButton.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("OnOffSwitch", com.codename1.components.OnOffSwitch.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("ImageViewer", com.codename1.components.ImageViewer.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("AutoCompleteTextField", com.codename1.ui.AutoCompleteTextField.class);
                com.codename1.ui.util.UIBuilder.registerCustomComponent("Picker", com.codename1.ui.spinner.Picker.class);
                com.codename1.ui.util.UIBuilder builder = new com.codename1.ui.util.UIBuilder();
                com.codename1.ui.Container c = builder.createContainer(res, selection);
                if (c instanceof com.codename1.ui.Form) {
                    ((com.codename1.ui.Form) c).refreshTheme();
                    if (c instanceof com.codename1.ui.Dialog) {
                        ((com.codename1.ui.Dialog) c).showModeless();
                    } else {
                        ((com.codename1.ui.Form) c).show();
                    }
                } else {
                    com.codename1.ui.Form f = new com.codename1.ui.Form();
                    f.setLayout(new com.codename1.ui.layouts.BorderLayout());
                    f.addComponent(com.codename1.ui.layouts.BorderLayout.CENTER, c);
                    f.refreshTheme();
                    f.show();
                }
            } catch (Exception ex) {
                ex.printStackTrace();
                JOptionPane.showMessageDialog(null, "Error While Running In Simulator: " + ex, "Error", JOptionPane.ERROR_MESSAGE);
            }
        }
    });
}
Also used : Preferences(java.util.prefs.Preferences) FileInputStream(java.io.FileInputStream) IOException(java.io.IOException) BackingStoreException(java.util.prefs.BackingStoreException) Resources(com.codename1.ui.util.Resources) File(java.io.File)

Example 2 with MultiButton

use of com.codename1.components.MultiButton in project CodenameOne by codenameone.

the class FontImage method setMaterialIcon.

/**
 * <p>Applies a material design icon (one of the MATERIAL_* icons above) to the given component using the
 * styling of the label</p>
 * <script src="https://gist.github.com/codenameone/8cf6f70188959524474b.js"></script>
 * @param l a multibutton
 * @param icon one of the MATERIAL_* icons
 * @param size the size of the icon in millimeters
 */
public static void setMaterialIcon(MultiButton l, char icon, float size) {
    if (Font.isTrueTypeFileSupported()) {
        Style s = new Style(l.getUnselectedStyle());
        s.setFont(getMaterialDesignFont().derive(rightSize(s, size), Font.STYLE_PLAIN));
        l.setIcon(FontImage.create("" + icon, s));
    }
}
Also used : Style(com.codename1.ui.plaf.Style)

Example 3 with MultiButton

use of com.codename1.components.MultiButton in project CodenameOne by codenameone.

the class EmailShare method createRendererMultiButton.

private MultiButton createRendererMultiButton() {
    MultiButton b = new MultiButton();
    b.setIconName("icon");
    b.setNameLine1("fname");
    b.setNameLine2("phone");
    b.setUIID("Label");
    return b;
}
Also used : MultiButton(com.codename1.components.MultiButton)

Example 4 with MultiButton

use of com.codename1.components.MultiButton in project CodenameOne by codenameone.

the class EmailShare method createListRenderer.

private ListCellRenderer createListRenderer() {
    MultiButton sel = createRendererMultiButton();
    MultiButton unsel = createRendererMultiButton();
    return new GenericListCellRenderer(sel, unsel);
}
Also used : GenericListCellRenderer(com.codename1.ui.list.GenericListCellRenderer) MultiButton(com.codename1.components.MultiButton)

Example 5 with MultiButton

use of com.codename1.components.MultiButton in project CodenameOne by codenameone.

the class SMSShare method createRendererMultiButton.

private MultiButton createRendererMultiButton() {
    MultiButton b = new MultiButton();
    b.setIconName("icon");
    b.setNameLine1("fname");
    b.setNameLine2("phone");
    b.setUIID("Label");
    return b;
}
Also used : MultiButton(com.codename1.components.MultiButton)

Aggregations

MultiButton (com.codename1.components.MultiButton)5 Form (com.codename1.ui.Form)2 GenericListCellRenderer (com.codename1.ui.list.GenericListCellRenderer)2 Button (com.codename1.ui.Button)1 CheckBox (com.codename1.ui.CheckBox)1 Container (com.codename1.ui.Container)1 Label (com.codename1.ui.Label)1 RadioButton (com.codename1.ui.RadioButton)1 Slider (com.codename1.ui.Slider)1 TextField (com.codename1.ui.TextField)1 Toolbar (com.codename1.ui.Toolbar)1 ActionEvent (com.codename1.ui.events.ActionEvent)1 ActionListener (com.codename1.ui.events.ActionListener)1 BorderLayout (com.codename1.ui.layouts.BorderLayout)1 BoxLayout (com.codename1.ui.layouts.BoxLayout)1 Style (com.codename1.ui.plaf.Style)1 Resources (com.codename1.ui.util.Resources)1 UIBuilderOverride (com.codename1.ui.util.UIBuilderOverride)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1