• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BorderLayout类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.codename1.ui.layouts.BorderLayout的典型用法代码示例。如果您正苦于以下问题:Java BorderLayout类的具体用法?Java BorderLayout怎么用?Java BorderLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BorderLayout类属于com.codename1.ui.layouts包,在下文中一共展示了BorderLayout类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
 
开发者ID:martijn00,项目名称:MusicPlayerCodenameOne,代码行数:21,代码来源:ToastView.java


示例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();
                }
            }
        }
    });
}
 
开发者ID:martijn00,项目名称:MusicPlayerCodenameOne,代码行数:18,代码来源:PlaylistOverviewView.java


示例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");


}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:17,代码来源:TestComponent.java


示例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);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:20,代码来源:Ads.java


示例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;
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:18,代码来源:Flickr.java


示例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);
    }
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:19,代码来源:Flickr.java


示例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;
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:20,代码来源:AbstractDemoChart.java


示例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);
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:26,代码来源:StateMachine.java


示例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);
            }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:23,代码来源:SpanLabel.java


示例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);
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:24,代码来源:PhotoShare.java


示例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;
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:24,代码来源:PhotoShare.java


示例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;
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:20,代码来源:KitchenSink.java


示例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;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:26,代码来源:RSSReader.java


示例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;
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:18,代码来源:Video.java


示例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();
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:27,代码来源:ReactDemo.java


示例16: setLinesTogetherMode

import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
/**
 * Changes the layout so the lines of the button are grouped together
 * @param l true to group the lines together
 */
public void setLinesTogetherMode(boolean l) {
    if(l != isLinesTogetherMode()) {
        if(l) {
            firstRow.getParent().removeComponent(firstRow);
            Container p = secondRow.getParent();
            p.addComponent(0, firstRow);
            Container pp = p.getParent();
            pp.removeComponent(p);
            pp.addComponent(BorderLayout.CENTER, p);
        } else {
            secondRow.getParent().removeComponent(secondRow);
            thirdRow.getParent().addComponent(0, secondRow);
        }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:20,代码来源:MultiButton.java


示例17: showShare

import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
private Component showShare() {
    final Container c = new Container(new BorderLayout());
    final ShareButton share = new ShareButton();
    final TextArea t = new TextArea("Sharing on Facebook with CodenameOne is a breeze.\n"
            + "http://www.codenameone.com\n"
            + "(Sent from the facebook demo app)");
    t.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent evt) {
            share.setTextToShare(t.getText());
        }
    });
    c.addComponent(BorderLayout.CENTER, t);
    share.setTextToShare(t.getText());
    Container cnt = new Container(new BorderLayout());
    cnt.addComponent(BorderLayout.SOUTH, share);
    c.addComponent(BorderLayout.EAST, cnt);
    return c;
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:20,代码来源:FBDemo.java


示例18: say

import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
void say(Container destination, String text, boolean question) {
    SpanLabel t = new SpanLabel(text);
    t.setWidth(destination.getWidth());
    t.setX(0);
    t.setHeight(t.getPreferredH());
    
    if(question) {
        t.setY(Display.getInstance().getDisplayHeight());
        t.setTextUIID("BubbleUser");
        t.setIconPosition(BorderLayout.EAST);
        t.setIcon(userPicture);
        t.setTextBlockAlign(Component.RIGHT);
    } else {
        t.setY(0);
        t.setTextUIID("BubbleSbaitso");
        t.setTextBlockAlign(Component.LEFT);
    }
    destination.addComponent(t);
    destination.animateLayoutAndWait(400);
    destination.scrollComponentToVisible(t);
}
 
开发者ID:codenameone,项目名称:codenameone-demos,代码行数:22,代码来源:DrSbaitso.java


示例19: getBorderLayoutDropLocation

import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
private String getBorderLayoutDropLocation(com.codename1.ui.Container dest, Point l) {
    Rectangle rect = new Rectangle(dest.getAbsoluteX(), dest.getAbsoluteY(), dest.getWidth(), dest.getHeight());
    Rectangle left = new Rectangle(rect.x, rect.y, rect.width / 5, rect.height);
    Rectangle right = new Rectangle(rect.x + rect.width - rect.width / 5, rect.y, rect.width / 5, rect.height);
    Rectangle top = new Rectangle(rect.x, rect.y, rect.width, rect.height / 5);
    Rectangle bottom = new Rectangle(rect.x, rect.y + rect.height - rect.height / 5, rect.width, rect.height / 5);
    if(left.contains(l)) {
        return com.codename1.ui.layouts.BorderLayout.WEST;
    } else {
        if(right.contains(l)) {
            return com.codename1.ui.layouts.BorderLayout.EAST;
        } else {
            if(top.contains(l)) {
                return com.codename1.ui.layouts.BorderLayout.NORTH;
            } else {
                if(bottom.contains(l)) {
                    return com.codename1.ui.layouts.BorderLayout.SOUTH;
                } else {
                    return com.codename1.ui.layouts.BorderLayout.CENTER;
                }
            }
        }
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:25,代码来源:UserInterfaceEditor.java


示例20: wrap

import com.codename1.ui.layouts.BorderLayout; //导入依赖的package包/类
/**
 * Wraps the given text field with a UI that will allow us to clear it
 * @param tf the text field
 * @param iconSize size in millimeters for the clear icon, -1 for default size
 * @return a Container that should be added to the UI instead of the actual text field
 */
public static ClearableTextField wrap(final TextArea tf, float iconSize) {
    ClearableTextField cf = new ClearableTextField();
    Button b = new Button("", tf.getUIID());
    if(iconSize > 0) {
        FontImage.setMaterialIcon(b, FontImage.MATERIAL_CLEAR, iconSize);
    } else {
        FontImage.setMaterialIcon(b, FontImage.MATERIAL_CLEAR);
    }
    removeCmpBackground(tf);
    removeCmpBackground(b);
    cf.setUIID(tf.getUIID());
    cf.add(BorderLayout.CENTER, tf);
    cf.add(BorderLayout.EAST, b);
    b.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            tf.stopEditing();
            tf.setText("");
            tf.startEditingAsync();
        }
    });
    return cf;        
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:29,代码来源:ClearableTextField.java



注:本文中的com.codename1.ui.layouts.BorderLayout类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RTPManager类代码示例发布时间:2022-05-22
下一篇:
Java FirebaseAuthInvalidUserException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap