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

The following examples show how to use com.codename1.ui.layouts.BorderLayout#SOUTH . 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: SheetSample.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 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();
}
 
Example 2
Source File: UIFragment.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Object newConstraint(Container parent, Element parentEl, Component child, Element childEl) {
    Layout l = parent.getLayout();
    if (l instanceof BorderLayout) {
        String cnst = childEl.getAttribute("constraint");
        if (cnst == null) {
            return BorderLayout.CENTER;
        }
        cnst = cnst.toLowerCase();
        if ("north".equals(cnst)) {
            return BorderLayout.NORTH;
        }
        if ("south".equals(cnst)) {
            return BorderLayout.SOUTH;
        }
        if ("east".equals(cnst)) {
            return BorderLayout.EAST;
        }
        if ("west".equals(cnst)) {
            return BorderLayout.WEST;
        }
        if ("center".equals(cnst)) {
            return BorderLayout.CENTER;
        }
        if ("overlay".equals(cnst)) {
            return BorderLayout.OVERLAY;
        }
        throw new IllegalArgumentException("Unsupported constraint "+cnst);
        
    }
    return null;
}
 
Example 3
Source File: Tabs.java    From CodenameOne with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the tab placement for this tabbedpane.
 * Possible values are:<ul>
 * <li><code>Component.TOP</code>
 * <li><code>Component.BOTTOM</code>
 * <li><code>Component.LEFT</code>
 * <li><code>Component.RIGHT</code>
 * </ul>
 * The default value, if not set, is <code>Component.TOP</code>.
 *
 * @param tabPlacement the placement for the tabs relative to the content
 */
public void setTabPlacement(int tabPlacement) {
    if (tabPlacement != TOP && tabPlacement != LEFT &&
            tabPlacement != BOTTOM && tabPlacement != RIGHT) {
        throw new IllegalArgumentException("illegal tab placement: must be TOP, BOTTOM, LEFT, or RIGHT");
    }
    if (this.tabPlacement == tabPlacement && tabsContainer.getParent() == null && isInitialized()) {
        return;
    }
    this.tabPlacement = tabPlacement;
    removeComponent(tabsContainer);

    setTabsLayout(tabPlacement);

    if (tabPlacement == TOP) {
        super.addComponent(BorderLayout.NORTH, tabsContainer);
    } else if (tabPlacement == BOTTOM) {
        super.addComponent(BorderLayout.SOUTH, tabsContainer);
    } else if (tabPlacement == LEFT) {
        super.addComponent(BorderLayout.WEST, tabsContainer);
    } else {// RIGHT
        super.addComponent(BorderLayout.EAST, tabsContainer);
    }

    initTabsFocus();

    tabsContainer.setShouldCalcPreferredSize(true);
    contentPane.setShouldCalcPreferredSize(true);

    revalidateWithAnimationSafety();
}