本文整理汇总了Java中com.codename1.ui.layouts.BorderLayout.setCenterBehavior方法的典型用法代码示例。如果您正苦于以下问题:Java BorderLayout.setCenterBehavior方法的具体用法?Java BorderLayout.setCenterBehavior怎么用?Java BorderLayout.setCenterBehavior使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.codename1.ui.layouts.BorderLayout
的用法示例。
在下文中一共展示了BorderLayout.setCenterBehavior方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addWaitingProgress
import com.codename1.ui.layouts.BorderLayout; //导入方法依赖的package包/类
private static void addWaitingProgress(Form f, boolean center, Container pane) {
pane.setVisible(false);
Container cnt = f.getLayeredPane();
BorderLayout bl = new BorderLayout();
bl.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
cnt.setLayout(bl);
if (center) {
cnt.addComponent(BorderLayout.CENTER, new InfiniteProgress());
} else {
Container top = new Container();
BorderLayout bl1 = new BorderLayout();
bl1.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
top.setLayout(bl1);
top.addComponent(BorderLayout.CENTER, new InfiniteProgress());
cnt.addComponent(BorderLayout.NORTH, top);
}
}
示例2: showMyFriends
import com.codename1.ui.layouts.BorderLayout; //导入方法依赖的package包/类
private Component showMyFriends() {
final Container c = new Container(new BorderLayout());
c.setScrollable(false);
BorderLayout bl = new BorderLayout();
bl.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
Container p = new Container(bl);
p.addComponent(BorderLayout.CENTER, new InfiniteProgress());
c.addComponent(BorderLayout.CENTER, p);
final List myFriends = new List();
myFriends.setRenderer(new FriendsRenderer());
try {
FaceBookAccess.getInstance().getUserFriends("me", (DefaultListModel) myFriends.getModel(), new ActionListener() {
public void actionPerformed(ActionEvent evt) {
c.removeAll();
c.addComponent(BorderLayout.CENTER, myFriends);
c.revalidate();
}
});
} catch (IOException ex) {
ex.printStackTrace();
}
return c;
}
示例3: adaptTitleLayoutBackCommandStructure
import com.codename1.ui.layouts.BorderLayout; //导入方法依赖的package包/类
void adaptTitleLayoutBackCommandStructure() {
Container t = getTitleAreaContainer();
if (t.getComponentCount() - componentCountOffset(t) == 3) {
return;
}
BorderLayout titleLayout = (BorderLayout) t.getLayout();
if (Display.COMMAND_BEHAVIOR_ICS == getCommandBehavior()) {
titleLayout.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_SCALE);
getTitleComponent().getUnselectedStyle().setAlignment(Component.LEFT, true);
} else {
titleLayout.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
}
t.removeAll();
t.addComponent(BorderLayout.CENTER, getTitleComponent());
Container leftContainer = new Container(new BoxLayout(BoxLayout.X_AXIS));
Container rightContainer = new Container(new BoxLayout(BoxLayout.X_AXIS));
t.addComponent(BorderLayout.EAST, rightContainer);
t.addComponent(BorderLayout.WEST, leftContainer);
initTitleBarStatus();
}
示例4: initLaf
import com.codename1.ui.layouts.BorderLayout; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
protected void initLaf(UIManager manager) {
super.initLaf(manager);
int tabPlace = manager.getThemeConstant("tabPlacementInt", -1);
tabsFillRows = manager.isThemeConstant("tabsFillRowsBool", false);
tabsGridLayout = manager.isThemeConstant("tabsGridBool", false);
changeTabOnFocus = manager.isThemeConstant("changeTabOnFocusBool", false);
BorderLayout bd = (BorderLayout)super.getLayout();
if(bd != null) {
if(manager.isThemeConstant("tabsOnTopBool", false)) {
if(bd.getCenterBehavior() != BorderLayout.CENTER_BEHAVIOR_TOTAL_BELOW) {
bd.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_TOTAL_BELOW);
checkTabsCanBeSeen();
}
} else {
bd.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_SCALE);
}
}
changeTabContainerStyleOnFocus = manager.isThemeConstant("changeTabContainerStyleOnFocusBool", false);
if(tabPlace != -1){
tabPlacement = tabPlace;
}
}
示例5: showLoginForm
import com.codename1.ui.layouts.BorderLayout; //导入方法依赖的package包/类
private void showLoginForm() {
Form login = new Form("Login");
BorderLayout bl = new BorderLayout();
bl.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
ComponentGroup loginDetails = new ComponentGroup();
TextField displayName = new TextField();
displayName.setHint("Display Name");
loginDetails.addComponent(displayName);
final TextField email = new TextField();
email.setHint("E-Mail");
loginDetails.addComponent(email);
Button send = new Button("Send Verification");
loginDetails.addComponent(send);
send.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
onSendAction(email);
}
});
login.setLayout(bl);
login.addComponent(BorderLayout.CENTER, loginDetails);
login.show();
}
示例6: unInstallMenuBar
import com.codename1.ui.layouts.BorderLayout; //导入方法依赖的package包/类
/**
* Removes the MenuBar from the parent Form
*/
protected void unInstallMenuBar() {
parent.removeComponentFromForm(this);
Container t = getTitleAreaContainer();
BorderLayout titleLayout = (BorderLayout) t.getLayout();
titleLayout.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_SCALE);
Component l = getTitleComponent();
t.removeAll();
if (l.getParent() != null) {
l.getParent().removeComponent(l);
}
t.addComponent(BorderLayout.CENTER, l);
initTitleBarStatus();
}
示例7: Tabs
import com.codename1.ui.layouts.BorderLayout; //导入方法依赖的package包/类
/**
* 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.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);
}
}
}
示例8: showSplashScreen
import com.codename1.ui.layouts.BorderLayout; //导入方法依赖的package包/类
/**
* The splash screen is relatively bare bones. Its important to have a splash screen for iOS
* since the build process generates a screenshot of this screen to speed up perceived performance
*/
public void showSplashScreen() {
final Form splash = new Form();
// a border layout places components in the center and the 4 sides.
// by default it scales the center component so here we configure
// it to place the component in the actual center
BorderLayout border = new BorderLayout();
border.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
splash.setLayout(border);
// by default the form's content pane is scrollable on the Y axis
// we need to disable it here
splash.setScrollable(false);
Label title = new Label("Poker Ace");
// The UIID is used to determine the appearance of the component in the theme
title.setUIID("SplashTitle");
Label subtitle = new Label("By Codename One");
subtitle.setUIID("SplashSubTitle");
splash.addComponent(BorderLayout.NORTH, title);
splash.addComponent(BorderLayout.SOUTH, subtitle);
Label as = new Label(cards.getImage("as.png"));
Label ah = new Label(cards.getImage("ah.png"));
Label ac = new Label(cards.getImage("ac.png"));
Label ad = new Label(cards.getImage("ad.png"));
// a layered layout places components one on top of the other in the same dimension, it is
// useful for transparency but in this case we are using it for an animation
final Container center = new Container(new LayeredLayout());
center.addComponent(as);
center.addComponent(ah);
center.addComponent(ac);
center.addComponent(ad);
splash.addComponent(BorderLayout.CENTER, center);
splash.show();
splash.setTransitionOutAnimator(CommonTransitions.createCover(CommonTransitions.SLIDE_VERTICAL, true, 800));
// postpone the animation to the next cycle of the EDT to allow the UI to render fully once
Display.getInstance().callSerially(new Runnable() {
public void run() {
// We replace the layout so the cards will be laid out in a line and animate the hierarchy
// over 2 seconds, this effectively creates the effect of cards spreading out
center.setLayout(new BoxLayout(BoxLayout.X_AXIS));
center.setShouldCalcPreferredSize(true);
splash.getContentPane().animateHierarchy(2000);
// after showing the animation we wait for 2.5 seconds and then show the game with a nice
// transition, notice that we use UI timer which is invoked on the Codename One EDT thread!
new UITimer(new Runnable() {
public void run() {
showGameUI();
}
}).schedule(2500, false, splash);
}
});
}
示例9: showSplashAnimation
import com.codename1.ui.layouts.BorderLayout; //导入方法依赖的package包/类
private void showSplashAnimation() {
Form splash = new Form();
splash.setUIID("Splash");
splash.getContentPane().setUIID("Container");
splash.getTitleArea().setUIID("Container");
BorderLayout border = new BorderLayout();
border.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
splash.setLayout(border);
splash.setScrollable(false);
Label title = new Label("Kitchen Sink Demo");
title.setUIID("SplashTitle");
Label subtitle = new Label("By Codename One");
subtitle.setUIID("SplashSubTitle");
splash.addComponent(BorderLayout.NORTH, title);
splash.addComponent(BorderLayout.SOUTH, subtitle);
Label beaker = new Label(res.getImage("beaker.png"));
final Label beakerLogo = new Label(res.getImage("beaker_logo.png"));
beakerLogo.setVisible(false);
Container layeredLayout = new Container(new LayeredLayout());
splash.addComponent(BorderLayout.CENTER, layeredLayout);
layeredLayout.addComponent(beaker);
final Container logoParent = new Container(new BorderLayout());
layeredLayout.addComponent(logoParent);
logoParent.addComponent(BorderLayout.CENTER, beakerLogo);
splash.revalidate();
Display.getInstance().callSerially(new Runnable() {
public void run() {
beakerLogo.setVisible(true);
beakerLogo.setX(0);
beakerLogo.setY(0);
beakerLogo.setWidth(3);
beakerLogo.setHeight(3);
logoParent.setShouldCalcPreferredSize(true);
logoParent.animateLayoutFade(2000, 0);
}
});
splash.show();
splash.setTransitionOutAnimator(CommonTransitions.createFastSlide(CommonTransitions.SLIDE_VERTICAL, true, 300));
new UITimer(new Runnable() {
public void run() {
showMainUI();
}
}).schedule(2500, false, splash);
}
示例10: updateTitleCommandPlacement
import com.codename1.ui.layouts.BorderLayout; //导入方法依赖的package包/类
private void updateTitleCommandPlacement() {
int commandBehavior = getCommandBehavior();
Container t = getTitleAreaContainer();
BorderLayout titleLayout = (BorderLayout) t.getLayout();
if (getParent() == null) {
installMenuBar();
} else {
if (getParent() == getTitleAreaContainer() && commandBehavior != Display.COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_RIGHT
&& commandBehavior != Display.COMMAND_BEHAVIOR_ICS) {
getParent().removeComponent(this);
installMenuBar();
}
}
if (!(parent instanceof Dialog)) {
if ((commandBehavior == Display.COMMAND_BEHAVIOR_ICS ||
commandBehavior == Display.COMMAND_BEHAVIOR_SIDE_NAVIGATION ||
commandBehavior == Display.COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_BACK)
&& parent.getTitle() != null && parent.getTitle().length() > 0) {
synchronizeCommandsWithButtonsInBackbutton();
return;
} else {
if (commandBehavior == Display.COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_RIGHT
|| commandBehavior == Display.COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_BACK) {
if (getParent() != null) {
if (getParent() == getTitleAreaContainer()) {
return;
}
getParent().removeComponent(this);
}
//getTitleAreaContainer().addComponent(BorderLayout.EAST, findRightTitleContainer());
return;
}
}
}
if (t.getComponentCount() - componentCountOffset(t) > 1) {
if (Display.COMMAND_BEHAVIOR_ICS == getCommandBehavior()) {
titleLayout.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_SCALE);
} else {
titleLayout.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE);
}
Component l = getTitleComponent();
if (l.getParent() != null) {
l.getParent().removeComponent(l);
}
t.removeAll();
t.addComponent(BorderLayout.CENTER, l);
initTitleBarStatus();
}
}