Java Code Examples for com.codename1.ui.layouts.BorderLayout#CENTER_BEHAVIOR_SCALE

The following examples show how to use com.codename1.ui.layouts.BorderLayout#CENTER_BEHAVIOR_SCALE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NestedFormWithSwipeableTabsTest2776.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
public void start() {
    if(current != null){
        current.show();
        return;
    }
    Form outer = new Form("", new BorderLayout(BorderLayout.CENTER_BEHAVIOR_SCALE));
    outer.getToolbar().hideToolbar();
    Form inner = new Form("Tabs", new BorderLayout());
    Container layeredPane1 = inner.getLayeredPane(NestedFormWithSwipeableTabsTest2776.class, 1);
    layeredPane1.setLayout(new BorderLayout());
    Container layeredPane2 = inner.getLayeredPane(AnotherClass.class, 2);
    layeredPane2.setLayout(new BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE));

    Tabs tab = new Tabs();
    tab.addTab("Tab1", new SpanLabel("Tab 1"));
    tab.addTab("Tab2", new SpanLabel("Tab 2"));

    inner.add(BorderLayout.CENTER, tab);
    outer.add(BorderLayout.CENTER, inner);
    outer.revalidate();
    outer.show();
}
 
Example 2
Source File: UIFragment.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
private static int centerBehaviour(String behaviour) {
    if ("scale".equalsIgnoreCase(behaviour)) {
        return BorderLayout.CENTER_BEHAVIOR_SCALE;
    }
    if ("absolute".equalsIgnoreCase(behaviour)) {
        return BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE;
    }
    if ("center".equalsIgnoreCase(behaviour)) {
        return BorderLayout.CENTER_BEHAVIOR_CENTER;
    }
    if ("totalBelow".equalsIgnoreCase(behaviour)) {
        return BorderLayout.CENTER_BEHAVIOR_TOTAL_BELOW;
    }
    return BorderLayout.CENTER_BEHAVIOR_SCALE;
}
 
Example 3
Source File: LoadingTextAnimationSample.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
private void showForm() {
    Form f = new Form("Hello", new BorderLayout(BorderLayout.CENTER_BEHAVIOR_SCALE));
    Form prev = CN.getCurrentForm();
    Toolbar tb = new Toolbar();
    f.setToolbar(tb);
    tb.addCommandToLeftBar("Back", null, evt->{
        prev.showBack();
    });
    SpanLabel profileText = new SpanLabel();
    
    profileText.setText("placeholder");
    f.add(BorderLayout.CENTER, profileText);
    // Replace the label by a CircleProgress to indicate that it is loading.
    LoadingTextAnimation.markComponentLoading(profileText);
    Button next = new Button("Next");
    next.addActionListener(e->{
        showLabelTest();
    });
    f.add(BorderLayout.SOUTH, next);
    AsyncResource<MyData> request = fetchDataAsync();
    request.ready(data -> {
        profileText.setText(data.getProfileText());

        // Replace the progress with the nameLabel now that
        // it is ready, using a fade transition
        LoadingTextAnimation.markComponentReady(profileText, CommonTransitions.createFade(300));
    });
    
    f.show();

}
 
Example 4
Source File: CameraKitPickerTest7.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
public void showAnotherForm(){
    Form form = new Form(new BorderLayout(BorderLayout.CENTER_BEHAVIOR_SCALE));
    form.setScrollable(false);
    Container container = new Container(BoxLayout.y());
    container.add(new Label("Test", "heading5"));
    container.add(new Label("", "newLine"));
    container.add(new Label("", "newLine"));

    final Picker fromDate = new Picker();
    fromDate.setType(Display.PICKER_TYPE_DATE);
    container.add(new Label("From Date", "heading7"));
    container.add(fromDate);
    container.add(new Label("", "newLine"));

    final Picker toDate = new Picker();
    toDate.setType(Display.PICKER_TYPE_DATE);
    container.add(new Label("To Date", "heading7"));
    container.add(toDate);

    Button nextBtn = new Button("Proceed");
    nextBtn.setUIID("loginBtn");
    nextBtn.addActionListener((ev) -> {
        DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
        String fromDateStr = dateFormat.format(fromDate.getDate());
        String toDateStr = dateFormat.format(toDate.getDate());
        
    });
    container.add(new Label("", "newLine"));
    container.add(new Label("", "newLine"));
    container.add(nextBtn);
    form.add(BorderLayout.CENTER, container);
    
    form.show();
}