Java 类java.awt.geom.Path2D.Float 实例源码

项目:jdk7-jdk    文件:Ruler.java   
/**
 * Applies the shape to window. It is recommended to apply shape in
 * componentResized() method
 */
@Override
public void componentResized(ComponentEvent e) {
    int h = getHeight();
    int w = getWidth();
    float a = (float) Math.hypot(h, w);
    Float path = new java.awt.geom.Path2D.Float();
    path.moveTo(0, 0);
    path.lineTo(w, 0);
    path.lineTo(0, h);
    path.closePath();
    path.moveTo(W, W);
    path.lineTo(W, h - W * (a + h) / w);
    path.lineTo(w - W * (a + w) / h, W);
    path.closePath();
    setShape(path);
}
项目:openjdk-source-code-learn    文件:Ruler.java   
/**
 * Applies the shape to window. It is recommended to apply shape in
 * componentResized() method
 */
@Override
public void componentResized(ComponentEvent e) {
    int h = getHeight();
    int w = getWidth();
    float a = (float) Math.hypot(h, w);
    Float path = new java.awt.geom.Path2D.Float();
    path.moveTo(0, 0);
    path.lineTo(w, 0);
    path.lineTo(0, h);
    path.closePath();
    path.moveTo(W, W);
    path.lineTo(W, h - W * (a + h) / w);
    path.lineTo(w - W * (a + w) / h, W);
    path.closePath();
    setShape(path);
}
项目:OpenJSharp    文件:Ruler.java   
public Shape buildShape() {
    int h = getHeight();
    int w = getWidth();
    float a = (float) Math.hypot(h, w);
    Float path = new java.awt.geom.Path2D.Float();
    path.moveTo(0, 0);
    path.lineTo(w, 0);
    path.lineTo(0, h);
    path.closePath();
    path.moveTo(W, W);
    path.lineTo(W, h - W * (a + h) / w);
    path.lineTo(w - W * (a + w) / h, W);
    path.closePath();
    return path;
}
项目:jdk8u-jdk    文件:Ruler.java   
public Shape buildShape() {
    int h = getHeight();
    int w = getWidth();
    float a = (float) Math.hypot(h, w);
    Float path = new java.awt.geom.Path2D.Float();
    path.moveTo(0, 0);
    path.lineTo(w, 0);
    path.lineTo(0, h);
    path.closePath();
    path.moveTo(W, W);
    path.lineTo(W, h - W * (a + h) / w);
    path.lineTo(w - W * (a + w) / h, W);
    path.closePath();
    return path;
}
项目:openjdk-jdk10    文件:Ruler.java   
public Shape buildShape() {
    int h = getHeight();
    int w = getWidth();
    float a = (float) Math.hypot(h, w);
    Float path = new java.awt.geom.Path2D.Float();
    path.moveTo(0, 0);
    path.lineTo(w, 0);
    path.lineTo(0, h);
    path.closePath();
    path.moveTo(W, W);
    path.lineTo(W, h - W * (a + h) / w);
    path.lineTo(w - W * (a + w) / h, W);
    path.closePath();
    return path;
}
项目:openjdk9    文件:Ruler.java   
public Shape buildShape() {
    int h = getHeight();
    int w = getWidth();
    float a = (float) Math.hypot(h, w);
    Float path = new java.awt.geom.Path2D.Float();
    path.moveTo(0, 0);
    path.lineTo(w, 0);
    path.lineTo(0, h);
    path.closePath();
    path.moveTo(W, W);
    path.lineTo(W, h - W * (a + h) / w);
    path.lineTo(w - W * (a + w) / h, W);
    path.closePath();
    return path;
}
项目:jdk8u_jdk    文件:Ruler.java   
public Shape buildShape() {
    int h = getHeight();
    int w = getWidth();
    float a = (float) Math.hypot(h, w);
    Float path = new java.awt.geom.Path2D.Float();
    path.moveTo(0, 0);
    path.lineTo(w, 0);
    path.lineTo(0, h);
    path.closePath();
    path.moveTo(W, W);
    path.lineTo(W, h - W * (a + h) / w);
    path.lineTo(w - W * (a + w) / h, W);
    path.closePath();
    return path;
}
项目:lookaside_java-1.8.0-openjdk    文件:Ruler.java   
public Shape buildShape() {
    int h = getHeight();
    int w = getWidth();
    float a = (float) Math.hypot(h, w);
    Float path = new java.awt.geom.Path2D.Float();
    path.moveTo(0, 0);
    path.lineTo(w, 0);
    path.lineTo(0, h);
    path.closePath();
    path.moveTo(W, W);
    path.lineTo(W, h - W * (a + h) / w);
    path.lineTo(w - W * (a + w) / h, W);
    path.closePath();
    return path;
}
项目:infobip-open-jdk-8    文件:Ruler.java   
public Shape buildShape() {
    int h = getHeight();
    int w = getWidth();
    float a = (float) Math.hypot(h, w);
    Float path = new java.awt.geom.Path2D.Float();
    path.moveTo(0, 0);
    path.lineTo(w, 0);
    path.lineTo(0, h);
    path.closePath();
    path.moveTo(W, W);
    path.lineTo(W, h - W * (a + h) / w);
    path.lineTo(w - W * (a + w) / h, W);
    path.closePath();
    return path;
}
项目:jdk8u-dev-jdk    文件:Ruler.java   
public Shape buildShape() {
    int h = getHeight();
    int w = getWidth();
    float a = (float) Math.hypot(h, w);
    Float path = new java.awt.geom.Path2D.Float();
    path.moveTo(0, 0);
    path.lineTo(w, 0);
    path.lineTo(0, h);
    path.closePath();
    path.moveTo(W, W);
    path.lineTo(W, h - W * (a + h) / w);
    path.lineTo(w - W * (a + w) / h, W);
    path.closePath();
    return path;
}
项目:OLD-OpenJDK8    文件:Ruler.java   
public Shape buildShape() {
    int h = getHeight();
    int w = getWidth();
    float a = (float) Math.hypot(h, w);
    Float path = new java.awt.geom.Path2D.Float();
    path.moveTo(0, 0);
    path.lineTo(w, 0);
    path.lineTo(0, h);
    path.closePath();
    path.moveTo(W, W);
    path.lineTo(W, h - W * (a + h) / w);
    path.lineTo(w - W * (a + w) / h, W);
    path.closePath();
    return path;
}
项目:openjdk-jdk7u-jdk    文件:Ruler.java   
public Shape buildShape() {
    int h = getHeight();
    int w = getWidth();
    float a = (float) Math.hypot(h, w);
    Float path = new java.awt.geom.Path2D.Float();
    path.moveTo(0, 0);
    path.lineTo(w, 0);
    path.lineTo(0, h);
    path.closePath();
    path.moveTo(W, W);
    path.lineTo(W, h - W * (a + h) / w);
    path.lineTo(w - W * (a + w) / h, W);
    path.closePath();
    return path;
}
项目:openjdk-icedtea7    文件:Ruler.java   
public Shape buildShape() {
    int h = getHeight();
    int w = getWidth();
    float a = (float) Math.hypot(h, w);
    Float path = new java.awt.geom.Path2D.Float();
    path.moveTo(0, 0);
    path.lineTo(w, 0);
    path.lineTo(0, h);
    path.closePath();
    path.moveTo(W, W);
    path.lineTo(W, h - W * (a + h) / w);
    path.lineTo(w - W * (a + w) / h, W);
    path.closePath();
    return path;
}