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


Java Border.createBevelRaised方法代码示例

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


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

示例1: findFlushingPropertyContrust

import com.codename1.ui.plaf.Border; //导入方法依赖的package包/类
/**
 * Returns a "contrasting" value for the property to flash, e.g. for a font,
 * return a differnet font or for a color return a ligher/darker color...
 */
private Object findFlushingPropertyContrust() {
    if (flashingProperty.indexOf("Color") > -1) {
        // flash to white or black depending on whether the color is closer to white
        int val = Integer.decode("0x" + originalFlashingPropertyValue);
        if (val > 0xf0f0f0) {
            return "000000";
        } else {
            return "ffffff";
        }
    }
    if (flashingProperty.indexOf("derive") > -1) {
        return "NoPropertyUIIDExists";
    }
    if (flashingProperty.indexOf("font") > -1) {
        // if this is not a bold font then just return a system bold font
        if ((((com.codename1.ui.Font) originalFlashingPropertyValue).getStyle() & com.codename1.ui.Font.STYLE_BOLD) != 0) {
            return com.codename1.ui.Font.createSystemFont(com.codename1.ui.Font.FACE_SYSTEM, com.codename1.ui.Font.STYLE_PLAIN, com.codename1.ui.Font.SIZE_LARGE);
        }
        return com.codename1.ui.Font.createSystemFont(com.codename1.ui.Font.FACE_SYSTEM, com.codename1.ui.Font.STYLE_BOLD, com.codename1.ui.Font.SIZE_LARGE);
    }
    if (flashingProperty.indexOf("bgImage") > -1) {
        com.codename1.ui.Image i = (com.codename1.ui.Image) originalFlashingPropertyValue;
        return i.modifyAlpha((byte) 128);
    }
    if (flashingProperty.indexOf("transparency") > -1) {
        int v = Integer.parseInt((String) originalFlashingPropertyValue);
        if (v < 128) {
            return "255";
        } else {
            return "100";
        }
    }
    /*
     * if(flashingProperty.indexOf("scale") > -1) { return "false"; }
     */
    if (flashingProperty.indexOf("padding") > -1 || flashingProperty.indexOf("margin") > -1) {
        return "10,10,10,10";
    }
    if (flashingProperty.indexOf("border") > -1) {
        if (originalFlashingPropertyValue != null) {
            Border pressed = ((Border) originalFlashingPropertyValue).createPressedVersion();
            if (pressed != null) {
                return pressed;
            }
        }
        return Border.createBevelRaised();
    }
    if (flashingProperty.indexOf("bgType") > -1) {
        return originalFlashingPropertyValue;
    }
    if (flashingProperty.indexOf("bgGradient") > -1) {
        Object[] gradient = new Object[4];
        System.arraycopy(originalFlashingPropertyValue, 0, gradient, 0, 4);
        gradient[0] = ((Object[]) originalFlashingPropertyValue)[1];
        gradient[1] = ((Object[]) originalFlashingPropertyValue)[0];
        return gradient;
    }
    if (flashingProperty.indexOf("align") > -1 || flashingProperty.indexOf("textDecoration") > -1) {
        return originalFlashingPropertyValue;
    }
    throw new IllegalArgumentException("Unsupported property type: " + flashingProperty);
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:67,代码来源:ThemeEditor.java

示例2: createBorder

import com.codename1.ui.plaf.Border; //导入方法依赖的package包/类
private Object createBorder(DataInputStream input, int type) throws IOException {
    switch(type) {
        // empty border
        case 0xff01:
            return Border.getEmpty();

        // Line border
        case 0xff02:
            // use theme colors?
            if(input.readBoolean()) {
                return Border.createLineBorder(input.readByte());
            } else {
                return Border.createLineBorder(input.readByte(), input.readInt());
            }

        // Rounded border
        case 0xff03:
            // use theme colors?
            if(input.readBoolean()) {
                return Border.createRoundBorder(input.readByte(), input.readByte());
            } else {
                return Border.createRoundBorder(input.readByte(), input.readByte(), input.readInt());
            }

        // Etched Lowered border
        case 0xff04:
            // use theme colors?
            if(input.readBoolean()) {
                return Border.createEtchedLowered();
            } else {
                return Border.createEtchedLowered(input.readInt(), input.readInt());
            }

        // Etched raised border
        case 0xff05:
            // use theme colors?
            if(input.readBoolean()) {
                return Border.createEtchedRaised();
            } else {
                return Border.createEtchedRaised(input.readInt(), input.readInt());
            }

        // Bevel raised
        case 0xff07:
            // use theme colors?
            if(input.readBoolean()) {
                return Border.createBevelRaised();
            } else {
                return Border.createBevelRaised(input.readInt(), input.readInt(), input.readInt(), input.readInt());
            }

        // Bevel lowered
        case 0xff06:
            // use theme colors?
            if(input.readBoolean()) {
                return Border.createBevelLowered();
            } else {
                return Border.createBevelLowered(input.readInt(), input.readInt(), input.readInt(), input.readInt());
            }

        // Image border
        case 0xff08:
            Object[] imageBorder = readImageBorder(input);
            return imageBorder;

        // horizontal Image border
        case 0xff09:
            return readImageBorder(input, "h");

        // vertical Image border
        case 0xff10:
            return readImageBorder(input, "v");

        // scaled Image border
        case 0xff11:
            return readScaledImageBorder(input);
    }
    return null;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:80,代码来源:Resources.java


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