当前位置: 首页>>代码示例>>Java>>正文


Java Border类代码示例

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


Border类属于com.codename1.ui.plaf包,在下文中一共展示了Border类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isImageInBorder

import com.codename1.ui.plaf.Border; //导入依赖的package包/类
private boolean isImageInBorder(String name) {
    com.codename1.ui.Image resourceValue = loadedResources.getImage(name);
    for(String themeName : loadedResources.getThemeResourceNames()) {
        Hashtable theme = loadedResources.getTheme(themeName);
        // we need to check the existance of image borders to replace images there...
        for(Object v : theme.values()) {
            if(v instanceof Border) {
                Border b = (Border)v;
                // BORDER_TYPE_IMAGE
                if(Accessor.getType(b) == Accessor.TYPE_IMAGE || Accessor.getType(b) == Accessor.TYPE_IMAGE_HORIZONTAL ||
                        Accessor.getType(b) == Accessor.TYPE_IMAGE_VERTICAL || Accessor.getType(b) == Accessor.TYPE_IMAGE_SCALED) {
                    com.codename1.ui.Image[] images = Accessor.getImages(b);
                    for(int i = 0 ; i < images.length ; i++) {
                        if(images[i] == resourceValue) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:24,代码来源:ResourceEditorView.java

示例2: imageBorderWizardActionPerformed

import com.codename1.ui.plaf.Border; //导入依赖的package包/类
private void imageBorderWizardActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_imageBorderWizardActionPerformed
    deriveBorder.setSelected(false);
    ImageBorderWizardTabbedPane iw = new ImageBorderWizardTabbedPane(resources, themeName);
    String name = (String)componentName.getSelectedItem();
    String uiid;
    if(prefix == null || prefix.length() == 0) {
        uiid = name + ".border";
    } else {
        uiid = name + "." + prefix + "border";
    }
    iw.addToAppliesToList(uiid);
    JDialog dlg = new JDialog(SwingUtilities.windowForComponent(this));
    dlg.setLayout(new java.awt.BorderLayout());
    dlg.add(java.awt.BorderLayout.CENTER, iw);
    dlg.pack();
    dlg.setLocationRelativeTo(this);
    dlg.setModal(true);
    dlg.setVisible(true);
    Border b = (Border)resources.getTheme(themeName).get(uiid);
    if(b != null) {
        currentBorder = b;
        ((CodenameOneComponentWrapper)borderLabel).getCodenameOneComponent().getStyle().setBorder(b);
        borderLabel.repaint();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:26,代码来源:AddThemeEntry.java

示例3: deinitializeImpl

import com.codename1.ui.plaf.Border; //导入依赖的package包/类
/**
 * Cleansup the initialization flags in the hierachy, notice that paint calls might
 * still occur after deinitilization mostly to perform transitions etc.
 * <p>However interactivity, animation and event tracking code can and probably
 * should be removed by this method.
 */
void deinitializeImpl() {
    if (isInitialized()) {
        hideNativeOverlay();
        paintLockRelease();
        setInitialized(false);
        setDirtyRegion(null);
        Style stl = getStyle();
        Image i = stl.getBgImage();
        if(i != null) {
            i.unlock();
        } else {
            Border b = stl.getBorder();
            if(b != null) {
                b.unlock();
            }
        }
        Painter p = stl.getBgPainter();
        if(p instanceof BGPainter) {
            ((BGPainter)p).radialCache = null;
        }           
        deinitialize();
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:30,代码来源:Component.java

示例4: renderComponent

import com.codename1.ui.plaf.Border; //导入依赖的package包/类
/**
 * Renders the current component on the screen
 */
private void renderComponent(Graphics g, Component cmp, int x, int y, int width, int height) {
    Style s = cmp.getStyle();
    int left = s.getMarginLeft(isRTL());
    int top =  s.getMarginTop();
    cmp.setWidth(width - left - s.getMarginRight(isRTL()));
    cmp.setHeight(height - top - s.getMarginBottom());
    cmp.setX(x + left);
    cmp.setY(y + top);

    int oX = g.getClipX();
    int oY = g.getClipY();
    int oWidth = g.getClipWidth();
    int oHeight = g.getClipHeight();
    //g.pushClip();
    g.clipRect(cmp.getX(), cmp.getY(), cmp.getWidth(), cmp.getHeight());

    cmp.paint(g);
    Border b = s.getBorder();
    if(b != null && !b.isBackgroundPainter()) {
        cmp.paintBorder(g);
    }
    g.setClip(oX, oY, oWidth, oHeight);
    //g.popClip();
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:28,代码来源:List.java

示例5: confirmBorder

import com.codename1.ui.plaf.Border; //导入依赖的package包/类
private Border confirmBorder(Hashtable h, String key) {
    Object val = h.get(key);
    if(val == null) {
        return null;
    }
    if(!(val instanceof Border)) {
        String[] value = (String[])val;
        if(value == null) {
            throw new IllegalArgumentException("Couldn't find resource: " + key);
        }

        // the resource was not already loaded when we loaded the theme
        // it must be loaded now so we can resolve the temporary name
        Border imageBorder = createImageBorder(value);
        return imageBorder;
    }
    return (Border)val;
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:19,代码来源:Resources.java

示例6: initComponentImpl

import com.codename1.ui.plaf.Border; //导入依赖的package包/类
/**
 * Invoked internally to initialize and bind the component
 */
void initComponentImpl() {
    if (!initialized) {
        initialized = true;
        UIManager manager = getUIManager();
        Style stl = getStyle();
        Image i = stl.getBgImage();
        if(i != null) {
            i.lock();
        } else {
            Border b = stl.getBorder();
            if(b != null) {
                b.lock();
            }
        }
        manager.getLookAndFeel().bind(this);
        checkAnimation();
        if(isRTL() && isScrollableX()){
            setScrollX(getScrollDimension().getWidth() - getWidth());
        }
        initComponent();
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:26,代码来源:Component.java

示例7: deinitializeImpl

import com.codename1.ui.plaf.Border; //导入依赖的package包/类
/**
 * Cleansup the initialization flags in the hierachy, notice that paint calls might
 * still occur after deinitilization mostly to perform transitions etc.
 * <p>However interactivity, animation and event tracking code can and probably
 * should be removed by this method.
 */
void deinitializeImpl() {
    if (isInitialized()) {
        paintLockRelease();
        setInitialized(false);
        setDirtyRegion(null);
        Style stl = getStyle();
        Image i = stl.getBgImage();
        if(i != null) {
            i.unlock();
        } else {
            Border b = stl.getBorder();
            if(b != null) {
                b.unlock();
            }
        }
        Painter p = stl.getBgPainter();
        if(p instanceof BGPainter) {
            ((BGPainter)p).radialCache = null;
        }           
        deinitialize();
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:29,代码来源:Component.java

示例8: renderComponent

import com.codename1.ui.plaf.Border; //导入依赖的package包/类
/**
 * Renders the current component on the screen
 */
private void renderComponent(Graphics g, Component cmp, int x, int y, int width, int height) {
    Style s = cmp.getStyle();
    int left = s.getMargin(isRTL(), LEFT);
    int top =  s.getMargin(false, TOP);
    cmp.setWidth(width - left - s.getMargin(isRTL(), RIGHT));
    cmp.setHeight(height - top - s.getMargin(false, BOTTOM));
    cmp.setX(x + left);
    cmp.setY(y + top);

    int oX = g.getClipX();
    int oY = g.getClipY();
    int oWidth = g.getClipWidth();
    int oHeight = g.getClipHeight();
    //g.pushClip();
    g.clipRect(cmp.getX(), cmp.getY(), cmp.getWidth(), cmp.getHeight());

    cmp.paint(g);
    Border b = s.getBorder();
    if(b != null && !b.isBackgroundPainter()) {
        cmp.paintBorder(g);
    }
    g.setClip(oX, oY, oWidth, oHeight);
    //g.popClip();
}
 
开发者ID:shannah,项目名称:cn1,代码行数:28,代码来源:List.java

示例9: writeBevelBorder

import com.codename1.ui.plaf.Border; //导入依赖的package包/类
private void writeBevelBorder(DataOutputStream output, Border border) throws IOException {
    // use theme colors?
    if(Accessor.isThemeColors(border)) {
        output.writeBoolean(true);
    } else {
        output.writeBoolean(false);
        output.writeInt(Accessor.getColorA(border));
        output.writeInt(Accessor.getColorB(border));
        output.writeInt(Accessor.getColorC(border));
        output.writeInt(Accessor.getColorD(border));
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:13,代码来源:EditableResources.java

示例10: writeEtchedBorder

import com.codename1.ui.plaf.Border; //导入依赖的package包/类
private void writeEtchedBorder(DataOutputStream output, Border border) throws IOException {
    // use theme colors?
    if(Accessor.isThemeColors(border)) {
        output.writeBoolean(true);
    } else {
        output.writeBoolean(false);
        output.writeInt(Accessor.getColorA(border));
        output.writeInt(Accessor.getColorB(border));
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:11,代码来源:EditableResources.java

示例11: writeImageBorder

import com.codename1.ui.plaf.Border; //导入依赖的package包/类
private void writeImageBorder(DataOutputStream output, Border border) throws IOException {
    // Write the number of images can be 2, 3, 8 or 9
    Image[] images = Accessor.getImages(border);
    int resourceCount = 0;
    for(int iter = 0 ; iter < images.length ; iter++) {
        if(images[iter] != null && findId(images[iter], true) != null) {
            resourceCount++;
        }
    }
    if(resourceCount != 2 && resourceCount != 3 && resourceCount != 8 && resourceCount != 9) {
        System.out.println("Odd resource count for image border: " + resourceCount);
        resourceCount = 2;
    }
    output.writeByte(resourceCount);
    switch(resourceCount) {
        case 2:
            output.writeUTF(findId(images[0], true));
            output.writeUTF(findId(images[4], true));
            break;
        case 3:
            output.writeUTF(findId(images[0], true));
            output.writeUTF(findId(images[4], true));
            output.writeUTF(findId(images[8], true));
            break;
        case 8:
            for(int iter = 0 ; iter < 8 ; iter++) {
                output.writeUTF(findId(images[iter], true));
            }
            break;
        case 9:
            for(int iter = 0 ; iter < 9 ; iter++) {
                output.writeUTF(findId(images[iter], true));
            }
            break;
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:37,代码来源:EditableResources.java

示例12: updateBackBorderToRTL

import com.codename1.ui.plaf.Border; //导入依赖的package包/类
private void updateBackBorderToRTL(Style s) {
    Border b = s.getBorder();
    if(b != null) {
        b = b.mirrorBorder();
        s.setBorder(b);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:8,代码来源:MenuBar.java

示例13: paintBackgroundImpl

import com.codename1.ui.plaf.Border; //导入依赖的package包/类
private void paintBackgroundImpl(Graphics g) {
    if (isBorderPainted()) {
        Border b = getBorder();
        if (b != null && b.isBackgroundPainter()) {
            b.paintBorderBackground(g, this);
            paintRippleEffect(g);
            return;
        }
    }
    if (getStyle().getBgPainter() != null) {
        getStyle().getBgPainter().paint(g, bounds);
    }
    paintBackground(g);
    paintRippleEffect(g);
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:16,代码来源:Component.java

示例14: paintBorder

import com.codename1.ui.plaf.Border; //导入依赖的package包/类
/**
 * Draws the component border if such a border exists. The border unlike the content
 * of the component will not be affected by scrolling for a scrollable component.
 * 
 * @param g graphics context on which the border is painted
 */
protected void paintBorder(Graphics g) {
    Border b = getBorder();
    if (b != null) {
        g.setColor(getStyle().getFgColor());
        b.paint(g, this);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:14,代码来源:Component.java

示例15: paintBorderBackground

import com.codename1.ui.plaf.Border; //导入依赖的package包/类
/**
 * Draws the component border background if such a border exists.
 * 
 * @param g graphics context on which the border is painted
 */
protected void paintBorderBackground(Graphics g) {
    Border b = getBorder();
    if (b != null) {
        b.paintBorderBackground(g, this);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:12,代码来源:Component.java


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