當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。