Java Code Examples for com.codename1.ui.layouts.BorderLayout#CENTER
The following examples show how to use
com.codename1.ui.layouts.BorderLayout#CENTER .
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 |
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 |
@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 |
/** * Creates an empty <code>TabbedPane</code> with the specified tab placement * of either: <code>Component.TOP</code>, <code>Component.BOTTOM</code>, * <code>Component.LEFT</code>, or <code>Component.RIGHT</code>. * * @param tabP the placement for the tabs relative to the content */ public Tabs(int tabP) { super(new BorderLayout()); focusListener = new TabFocusListener(); contentPane.setUIID("TabbedPane"); super.addComponent(BorderLayout.CENTER, contentPane); tabsContainer = new Container(); tabsContainer.setSafeArea(true); tabsContainer.setUIID("TabsContainer"); tabsContainer.setScrollVisible(false); tabsContainer.getStyle().setMargin(0, 0, 0, 0); if(tabP == -1){ setTabPlacement(tabPlacement); }else{ setTabPlacement(tabP); } press = new SwipeListener(SwipeListener.PRESS); drag = new SwipeListener(SwipeListener.DRAG); release = new SwipeListener(SwipeListener.RELEASE); setUIID("Tabs"); BorderLayout bd = (BorderLayout)super.getLayout(); if(bd != null) { if(UIManager.getInstance().isThemeConstant("tabsOnTopBool", false)) { bd.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_TOTAL_BELOW); } else { bd.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_SCALE); } } }
Example 4
Source File: InteractionDialog.java From CodenameOne with GNU General Public License v2.0 | 5 votes |
private void init() { setUIID("Dialog"); title.setUIID("DialogTitle"); contentPane.setUIID("DialogContentPane"); super.addComponent(BorderLayout.NORTH, titleArea); titleArea.addComponent(BorderLayout.CENTER, title); super.addComponent(BorderLayout.CENTER, contentPane); setGrabsPointerEvents(true); }