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


Java Point类代码示例

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


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

示例1: setValueInternal

import org.apache.pivot.wtk.Point; //导入依赖的package包/类
protected void setValueInternal(Object value) {
    if (null == value) {
        super.setValueInternal(null);
    } else if (value instanceof CharSequence) {
        handleAsString(String.valueOf(value));
    } else if (value instanceof List) {
        handleAsList((List) value);
    } else if (value instanceof Map) {
        handleAsMap((Map) value);
    } else if (value instanceof Number) {
        handleAsNumber((Number) value);
    } else if (value instanceof Point) {
        super.setValueInternal(value);
    } else {
        throw illegalValue(value, Point.class);
    }
}
 
开发者ID:aalmiray,项目名称:griffon2,代码行数:18,代码来源:PointPropertyEditor.java

示例2: handleAsString

import org.apache.pivot.wtk.Point; //导入依赖的package包/类
private void handleAsString(String str) {
    if (isBlank(str)) {
        super.setValueInternal(null);
        return;
    }

    String[] parts = str.split(",");
    switch (parts.length) {
        case 1:
            int s = parseValue(parts[0]);
            super.setValueInternal(new Point(s, s));
            break;
        case 2:
            int x = parseValue(parts[0]);
            int y = parseValue(parts[1]);
            super.setValueInternal(new Point(x, y));
            break;
        default:
            throw illegalValue(str, Point.class);
    }
}
 
开发者ID:aalmiray,项目名称:griffon2,代码行数:22,代码来源:PointPropertyEditor.java

示例3: handleAsList

import org.apache.pivot.wtk.Point; //导入依赖的package包/类
private void handleAsList(List<?> list) {
    if(list.isEmpty()) {
        super.setValueInternal(null);
        return;
    }

    switch (list.size()) {
        case 1:
            int s = parseValue(list.get(0));
            super.setValueInternal(new Point(s, s));
            break;
        case 2:
            int x = parseValue(list.get(0));
            int y = parseValue(list.get(1));
            super.setValueInternal(new Point(x, y));
            break;
        default:
            throw illegalValue(list, Point.class);
    }
}
 
开发者ID:aalmiray,项目名称:griffon2,代码行数:21,代码来源:PointPropertyEditor.java

示例4: tooltipTriggered

import org.apache.pivot.wtk.Point; //导入依赖的package包/类
@Override
public void tooltipTriggered(Component component, int x, int y) {
    String tooltipText = component.getTooltipText();
    if (!isNullOrEmpty(tooltipText)) {
        Display display = component.getDisplay();
        Point location = component.mapPointToAncestor(display, x, y);
        int tooltipX = location.x + 16;
        int tooltipY = location.y;
        TextArea content = new TextArea();
        content.getStyles().put("wrapText", Boolean.TRUE);
        content.getStyles().put("margin", new Insets(0));
        content.setPreferredWidth(Math.min(display.getWidth() - tooltipX, getStringWidth(tooltipText, (Font) content.getStyles().get("font"))));
        content.setText(tooltipText);
        Tooltip tooltip = new Tooltip(content);
        int tooltipWidth = tooltip.getPreferredWidth();
        int tooltipHeight = tooltip.getPreferredHeight();
        // ensure tooltip is inside display's bounds
        if (tooltipX + tooltipWidth > display.getWidth()) {
            tooltipX -= tooltipX + tooltipWidth - display.getWidth();
        }
        if (tooltipY + tooltipHeight > display.getHeight()) {
            tooltipY -= tooltipHeight;
        }
        tooltip.setLocation(tooltipX, tooltipY);
        tooltip.open(component.getWindow());
    }
}
 
开发者ID:groovejames,项目名称:groovejames,代码行数:28,代码来源:TooltipTableMouseListener.java

示例5: handleAsMap

import org.apache.pivot.wtk.Point; //导入依赖的package包/类
private void handleAsMap(Map<?, ?> map) {
    if(map.isEmpty()) {
        super.setValueInternal(null);
        return;
    }

    int x = getMapValue(map, "x", 0);
    int y = getMapValue(map, "y", 0);
    super.setValueInternal(new Point(x, y));
}
 
开发者ID:aalmiray,项目名称:griffon2,代码行数:11,代码来源:PointPropertyEditor.java

示例6: parseValue

import org.apache.pivot.wtk.Point; //导入依赖的package包/类
private int parseValue(Object value) {
    if (value instanceof CharSequence) {
        return parse(String.valueOf(value));
    } else if (value instanceof Number) {
        return parse((Number) value);
    }
    throw illegalValue(value, Point.class);
}
 
开发者ID:aalmiray,项目名称:griffon2,代码行数:9,代码来源:PointPropertyEditor.java

示例7: parse

import org.apache.pivot.wtk.Point; //导入依赖的package包/类
private int parse(String val) {
    try {
        return Integer.parseInt(val.trim());
    } catch (NumberFormatException e) {
        throw illegalValue(val, Point.class, e);
    }
}
 
开发者ID:aalmiray,项目名称:griffon2,代码行数:8,代码来源:PointPropertyEditor.java

示例8: getMapValue

import org.apache.pivot.wtk.Point; //导入依赖的package包/类
private int getMapValue(Map<?, ?> map, String key, int defaultValue) {
    Object val = map.get(key);
    if (null == val) {
        return defaultValue;
    } else if (val instanceof CharSequence) {
        return parse(String.valueOf(val));
    } else if (val instanceof Number) {
        return parse((Number) val);
    }
    throw illegalValue(map, Point.class);
}
 
开发者ID:aalmiray,项目名称:griffon2,代码行数:12,代码来源:PointPropertyEditor.java

示例9: getAsText

import org.apache.pivot.wtk.Point; //导入依赖的package包/类
public String getAsText() {
    if (null == getValue()) return null;
    Point p = (Point) getValue();
    return p.x + ", " + p.y;
}
 
开发者ID:aalmiray,项目名称:griffon2,代码行数:6,代码来源:PointPropertyEditor.java

示例10: handleAsNumber

import org.apache.pivot.wtk.Point; //导入依赖的package包/类
private void handleAsNumber(Number value) {
    int s = parse(value);
    super.setValueInternal(new Point(s, s));
}
 
开发者ID:aalmiray,项目名称:griffon2,代码行数:5,代码来源:PointPropertyEditor.java


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