Search in sources :

Example 1 with RadioButtonList

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

the class SheetSample method start.

public void start() {
    if (current != null) {
        current.show();
        return;
    }
    Form hi = new Form("Hi World", new BorderLayout());
    RadioButtonList sheetPos = new RadioButtonList(new DefaultListModel(BorderLayout.NORTH, BorderLayout.EAST, BorderLayout.SOUTH, BorderLayout.WEST, BorderLayout.CENTER));
    Button b = new Button("Open Sheet");
    b.addActionListener(e -> {
        MySheet sheet = new MySheet(null);
        int positionIndex = sheetPos.getModel().getSelectedIndex();
        if (positionIndex >= 0) {
            String pos = (String) sheetPos.getModel().getItemAt(positionIndex);
            sheet.setPosition(pos);
        }
        sheet.show();
    });
    hi.add(BorderLayout.NORTH, BoxLayout.encloseY(sheetPos, b));
    hi.show();
}
Also used : BorderLayout(com.codename1.ui.layouts.BorderLayout) Form(com.codename1.ui.Form) Button(com.codename1.ui.Button) RadioButtonList(com.codename1.components.RadioButtonList) DefaultListModel(com.codename1.ui.list.DefaultListModel)

Aggregations

RadioButtonList (com.codename1.components.RadioButtonList)1 Button (com.codename1.ui.Button)1 Form (com.codename1.ui.Form)1 BorderLayout (com.codename1.ui.layouts.BorderLayout)1 DefaultListModel (com.codename1.ui.list.DefaultListModel)1