本文整理汇总了Java中com.codename1.ui.layouts.BorderLayout类的典型用法代码示例。如果您正苦于以下问题:Java BorderLayout类的具体用法?Java BorderLayout怎么用?Java BorderLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BorderLayout类属于com.codename1.ui.layouts包,在下文中一共展示了BorderLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
public static void show(String text, final Form f)
{
isVisible = true;
f.getLayeredPane().setLayout(new BorderLayout());
final Label l = new Label(text);
l.setUIID("ToastMessage");
f.getLayeredPane().addComponent(BorderLayout.SOUTH, l);
f.repaint();
Timer exitTimer = new Timer();
exitTimer.schedule(new TimerTask() {
@Override
public void run() {
f.getLayeredPane().removeAll();
f.repaint();
isVisible = false;
}
}, toastTimeOut);
}
示例2: updateModel
import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
public void updateModel(final List cmp, java.util.List playlists)
{
cmp.setModel(new DefaultListModel(parsePlaylists(playlists)));
Display.getInstance().callSerially(new Runnable() {
@Override
public void run() {
if (cmp.getComponentForm() != null && cmp.getComponentForm().getContentPane() != null) {
BorderLayout bl = (BorderLayout) cmp.getComponentForm().getContentPane().getLayout();
if (bl.getNorth() != null) {
cmp.getComponentForm().getContentPane().removeComponent(bl.getNorth());
cmp.getComponentForm().repaint();
}
}
}
});
}
示例3: getComponentAt_int_int_label
import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
private void getComponentAt_int_int_label() {
log("Testing getComponentAt(x, y) with label");
int w = Display.getInstance().getDisplayWidth();
int h = Display.getInstance().getDisplayHeight();
Form f = new Form("My Form", new BorderLayout());
Label l = new Label("Hello");
f.add(BorderLayout.CENTER, l);
f.show();
TestUtils.waitForFormTitle("My Form", 2000);
Component middleComponent = f.getComponentAt(w/2, h/2);
assertEqual(l, middleComponent, "Found wrong component");
}
示例4: setHeight
import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void setHeight(int height) {
float percent = ((float)height/(float)Display.getInstance().getDisplayHeight());
percent *= 100;
//if the banner height is more then 25% it's a bad ad we need to
//remove it.
if(percent > 25){
removeAll();
Label filler = new Label(" ");
filler.setPreferredSize(new Dimension(400, 2));
filler.getStyle().setBgTransparency(0);
addComponent(BorderLayout.CENTER, filler);
revalidate();
}else{
super.setHeight(height);
}
}
示例5: createMainForm
import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
public static Form createMainForm() {
Form main = new Form("Flickr tags");
main.setLayout(new BorderLayout());
Toolbar bar = new Toolbar();
main.setToolBar(bar);
addCommandsToToolbar(bar);
TextArea desc = new TextArea();
desc.setText("This is a Flickr tags demo, the demo uses the Toolbar to arrange the Form Commands.\n\n"
+ "Select \"Cats\" to view the latest photos that were tagged as \"Cats\".\n\n"
+ "Select \"Dogs\" to view the latest photos that were tagged as \"Dogs\".\n\n"
+ "Select \"Search\" to enter your own tags for search.");
desc.setEditable(false);
main.addComponent(BorderLayout.CENTER, desc);
return main;
}
示例6: 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);
}
}
示例7: wrap
import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
protected Form wrap(String title, Component c){
c.getStyle().setBgColor(0xff0000);
Form f = new Form(title);
f.setLayout(new BorderLayout());
if (isDrawOnMutableImage()) {
int dispW = Display.getInstance().getDisplayWidth();
int dispH = Display.getInstance().getDisplayHeight();
Image img = Image.createImage((int)(dispW * 0.8), (int)(dispH * 0.8), 0x0);
Graphics g = img.getGraphics();
c.setWidth((int)(dispW * 0.8));
c.setHeight((int)(dispH * 0.8));
c.paint(g);
f.addComponent(BorderLayout.CENTER, new Label(img));
} else {
f.addComponent(BorderLayout.CENTER, c);
}
return f;
}
示例8: beforeMaps
import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
@Override
protected void beforeMaps(Form f) {
Container entriesContainer = findEntries(f);
((BorderLayout)entriesContainer.getLayout()).setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_TOTAL_BELLOW);
MapComponent map = findMapEntry(f);
entriesContainer.removeComponent(map);
entriesContainer.addComponent(0, BorderLayout.CENTER, map);
if(Display.getInstance().isTablet()) {
Container listATMs = new Container(new BoxLayout(BoxLayout.Y_AXIS));
listATMs.setHideInPortrait(true);
addATMs(listATMs, false);
Container portraitListATMs = new Container(new BoxLayout(BoxLayout.Y_AXIS));
addATMs(portraitListATMs, false);
MasterDetail.bindTabletLandscapeMaster(f, f, listATMs, portraitListATMs, "ATM's", null);
entriesContainer.removeComponent(findMapOverlay(f));
} else {
findAtmMainTitle(f).setText(current.name);
findAtmMainDistance(f).setText(current.distance);
findAtmMainZip(f).setText(current.zip);
findAtmMainText(f).setText(current.location);
findAtmMainUnit(f).setText(current.metric);
findAtmMainPaid(f).setText(current.paid);
}
updateFormMap(f);
}
示例9: setTextBlockAlign
import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
/**
* Indicates the alignment of the whole text block, this is different from setting the alignment of the text within
* the block since the UIID might have a border or other design element that won't be affected by such alignment.
* The default is none (-1) which means no alignment takes place and the text block takes the whole width.
* @param align valid values are Component.LEFT, Component.RIGHT, Component.CENTER. Anything else will
* stretch the text block
*/
public void setTextBlockAlign(int align) {
switch(align) {
case LEFT:
case RIGHT:
case CENTER:
wrapText(align);
return;
default:
if(text.getParent() != this) {
removeComponent(text.getParent());
text.getParent().removeAll();
addComponent(BorderLayout.CENTER, text);
}
}
}
示例10: showMainForm
import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
private void showMainForm() {
final Form photos = new Form("Photos");
photos.setLayout(new BorderLayout());
GridLayout gr = new GridLayout(1, 1);
final Container grid = new Container(gr);
gr.setAutoFit(true);
grid.setScrollableY(true);
grid.addPullToRefresh(new Runnable() {
public void run() {
refreshGrid(grid);
}
});
grid.addComponent(new InfiniteProgress());
photos.addComponent(BorderLayout.CENTER, grid);
photos.removeAllCommands();
photos.setBackCommand(null);
photos.addCommand(createPictureCommand(grid));
photos.show();
refreshGrid(grid);
}
示例11: createImageButton
import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
Button createImageButton(final long imageId, final Container grid, final int offset) {
final Button btn = new Button(URLImage.createToFileSystem(placeholder, FileSystemStorage.getInstance().getAppHomePath() + "/Thumb_" + imageId, THUMB_URL_PREFIX + imageId, URLImage.RESIZE_SCALE_TO_FILL));
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
imageList.setSelectedIndex(offset);
final Container viewerParent = new Container(new LayeredLayout());
ImageViewer viewer = new ImageViewer(imageList.getItemAt(offset));
viewerParent.addComponent(viewer);
Container parent = new Container(new BorderLayout());
viewerParent.addComponent(parent);
parent.addComponent(BorderLayout.SOUTH, createToolbar(imageId));
likeCount = new Label("");
parent.addComponent(BorderLayout.NORTH, likeCount);
viewer.setImageList(imageList);
grid.getParent().replace(grid, viewerParent, CommonTransitions.createSlide(CommonTransitions.SLIDE_HORIZONTAL, false, 300));
Display.getInstance().getCurrent().setBackCommand(createBackCommand(viewerParent, grid));
}
});
return btn;
}
示例12: wrapInShelves
import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
/**
* This method wraps the layout in a way so the shelves are rendered underneath the
* given component
*/
private Container wrapInShelves(Container c) {
Container layered = new Container(new LayeredLayout());
Container sides = new Container(new BorderLayout());
Label right = new Label(" ");
right.setUIID("Right");
sides.addComponent(BorderLayout.EAST, right);
Label left = new Label(" ");
left.setUIID("Left");
sides.addComponent(BorderLayout.WEST, left);
layered.addComponent(sides);
layered.addComponent(c);
return layered;
}
示例13: createRendererContainer
import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
private Container createRendererContainer() {
Container entries = new Container(new BoxLayout(BoxLayout.Y_AXIS));
entries.setUIID("RSSEntry");
Label title = new Label();
title.setName("title");
title.setUIID("RSSTitle");
entries.addComponent(title);
TextArea description = new TextArea(2, 30);
description.setGrowByContent(false);
description.setName("details");
description.setUIID("RSSDescription");
description.setScrollVisible(false);
entries.addComponent(description);
if(iconPlaceholder != null) {
Container wrap = new Container(new BorderLayout());
wrap.addComponent(BorderLayout.CENTER, entries);
Label icon = new Label();
icon.setIcon(iconPlaceholder);
icon.setUIID("RSSIcon");
icon.setName("icon");
wrap.addComponent(BorderLayout.WEST, icon);
entries = wrap;
}
return entries;
}
示例14: createDemo
import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
public Container createDemo() {
Container player = new Container(new BorderLayout());
final MediaPlayer mp = new MediaPlayer();
try {
InputStream is = Display.getInstance().getResourceAsStream(getClass(), "/video.mp4");
if(is != null) {
mp.setDataSource(is, "video/mp4", null);
} else {
mp.setDataSource("https://dl.dropbox.com/u/57067724/cn1/video.mp4");
}
} catch (IOException ex) {
ex.printStackTrace();
}
player.addComponent(BorderLayout.CENTER, mp);
return player;
}
示例15: start
import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
public void start() {
if(current != null){
current.show();
return;
}
placeholder = EncodedImage.createFromImage(Image.createImage(53, 81, 0), false);
Form react = new Form("React Demo", new BorderLayout());
react.add(BorderLayout.CENTER, new InfiniteContainer() {
public Component[] fetchComponents(int index, int amount) {
try {
Collection data = (Collection)ConnectionRequest.fetchJSON(REQUEST_URL).get("movies");
Component[] response = new Component[data.size()];
int offset = 0;
for(Object movie : data) {
response[offset] = createMovieEntry(Result.fromContent((Map)movie));
offset++;
}
return response;
} catch(IOException err) {
Dialog.show("Error", "Error during connection: " + err, "OK", null);
}
return null;
}
});
react.show();
}