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


Java IllegalPathStateException类代码示例

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


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

示例1: testAddClose

import java.awt.geom.IllegalPathStateException; //导入依赖的package包/类
static void testAddClose(Path2D pathA, boolean isEmpty) {
    try {
        addClose(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddClose: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddClose: passed.");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:19,代码来源:Path2DCopyConstructor.java

示例2: testAddLine

import java.awt.geom.IllegalPathStateException; //导入依赖的package包/类
static void testAddLine(Path2D pathA, boolean isEmpty) {
    try {
        addLines(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddLine: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddLine: passed.");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:Path2DCopyConstructor.java

示例3: testAddQuad

import java.awt.geom.IllegalPathStateException; //导入依赖的package包/类
static void testAddQuad(Path2D pathA, boolean isEmpty) {
    try {
        addQuads(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddQuad: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddQuad: passed.");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:Path2DCopyConstructor.java

示例4: testAddCubic

import java.awt.geom.IllegalPathStateException; //导入依赖的package包/类
static void testAddCubic(Path2D pathA, boolean isEmpty) {
    try {
        addCubics(pathA);
    }
    catch (IllegalPathStateException ipse) {
        if (isEmpty) {
            log("testAddCubic: passed "
                + "(expected IllegalPathStateException catched).");
            return;
        } else {
            throw ipse;
        }
    }
    if (isEmpty) {
        throw new IllegalStateException("IllegalPathStateException not thrown !");
    }
    log("testAddCubic: passed.");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:Path2DCopyConstructor.java

示例5: validateProjectDirectory

import java.awt.geom.IllegalPathStateException; //导入依赖的package包/类
/**
 * Validates the given file to be a directory, and throws an exception if the given
 * file is not a directory, or if the file is null.
 * 
 * @param projectDirectory
 *            File to validate
 */
private static void validateProjectDirectory(File projectDirectory)
{
	if (projectDirectory == null)
	{
		throw new IllegalArgumentException("Directory must be non-null");
	}
	// When creating project, the directory has not been created yet so always throws
	// error
	else
	{
		//moved this
		if (!projectDirectory.exists())
			projectDirectory.mkdir();
		
		if (!projectDirectory.isDirectory())
		
		{
			String path = projectDirectory.getAbsolutePath();
			String message = "Path must point to a directory. Found: " + path;
			throw new IllegalPathStateException(message);
		}
	}
}
 
开发者ID:dhawal9035,项目名称:WebPLP,代码行数:31,代码来源:PLPProject.java

示例6: getArea

import java.awt.geom.IllegalPathStateException; //导入依赖的package包/类
public double getArea(float scaleX, float scaleY)
{
	try
	{
		return GeomertyToolkit
				.getArea(GeomertyToolkit.toPath(points), scaleX, scaleY);
	} catch (IllegalPathStateException e)
	{
		return 0;
	}

}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:13,代码来源:PolygonControler.java

示例7: getLength

import java.awt.geom.IllegalPathStateException; //导入依赖的package包/类
public double getLength(float scaleX, float scaleY)
{
	try
	{
		return GeomertyToolkit.getPathLength(GeomertyToolkit.toPath(points), scaleX, scaleY);
	}
	catch(IllegalPathStateException e)
	{
		return 0;
	}
}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:12,代码来源:PolygonControler.java

示例8: Morphing2D

import java.awt.geom.IllegalPathStateException; //导入依赖的package包/类
/**
 * <p>Creates a new morphing shape. A morphing shape can be used to turn
 * one shape into another one. The transformation can be controlled by the
 * morph property.</p>
 *
 * @param startShape the shape to morph from
 * @param endShape   the shape to morph to
 *
 * @throws IllegalPathStateException if the shapes do not have the same
 *                                   winding rule
 * @see #getMorphing()
 * @see #setMorphing(double)
 */
public Morphing2D(Shape startShape, Shape endShape) {
    startGeometry = new Geometry(startShape);
    endGeometry = new Geometry(endShape);
    if (startGeometry.getWindingRule() != endGeometry.getWindingRule()) {
        throw new IllegalPathStateException("shapes must use same " +
                                            "winding rule");
    }
    double tvals0[] = startGeometry.getTvals();
    double tvals1[] = endGeometry.getTvals();
    double masterTvals[] = mergeTvals(tvals0, tvals1);
    startGeometry.setTvals(masterTvals);
    endGeometry.setTvals(masterTvals);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:27,代码来源:Morphing2D.java

示例9: needRoom

import java.awt.geom.IllegalPathStateException; //导入依赖的package包/类
@Override
void needRoom(boolean needMove, int newCoords) {
    if ((numTypes == 0) && needMove) {
        throw new IllegalPathStateException("missing initial moveto "+
                                            "in path definition");
    }
    if (numTypes >= pointTypes.length) {
        pointTypes = expandPointTypes(pointTypes, 1);
    }
    if (numCoords > (floatCoords.length - newCoords)) {
        floatCoords = expandCoords(floatCoords, newCoords);
    }
}
 
开发者ID:bourgesl,项目名称:marlin-renderer,代码行数:14,代码来源:Path2D.java

示例10: getShape

import java.awt.geom.IllegalPathStateException; //导入依赖的package包/类
@Override
public Shape getShape() {
  Path2D shape = new Path2D.Float();
  int xDiff = Math.abs(getSuperclass().getCenterX() - getSubclass().getCenterX());
  int yDiff = Math.abs(getSuperclass().getCenterY() - getSubclass().getCenterY());
  if (xDiff > 2 * yDiff) {
    if (getSuperclass().getStartX() > getSubclass().getEndX()) {
      trianglePosition = Position.LEFT;
      shape.moveTo(getSuperclass().getStartX(), getSuperclass().getCenterY());
      shape.lineTo(getSuperclass().getStartX() - cos30,
        getSuperclass().getCenterY() - sin30);
      shape.lineTo(getSuperclass().getStartX() - cos30,
        getSuperclass().getCenterY() - sinNeg30);
      shape.lineTo(getSuperclass().getStartX(), getSuperclass().getCenterY());
    } else if (getSuperclass().getEndX() < getSubclass().getStartX()) {
      trianglePosition = Position.RIGHT;
      shape.moveTo(getSuperclass().getEndX(), getSuperclass().getCenterY());
      shape.lineTo(getSuperclass().getEndX() + cos30,
        getSuperclass().getCenterY() + sin30);
      shape.lineTo(getSuperclass().getEndX() + cos30,
        getSuperclass().getCenterY() + sinNeg30);
      shape.lineTo(getSuperclass().getEndX(), getSuperclass().getCenterY());
    }
  } else {
    if (getSuperclass().getStartY() > getSubclass().getEndY()) {
      trianglePosition = Position.TOP;
      shape.moveTo(getSuperclass().getCenterX(), getSuperclass().getStartY());
      shape.lineTo(getSuperclass().getCenterX() - sin30,
        getSuperclass().getStartY() - cos30);// 30°
      shape.lineTo(getSuperclass().getCenterX() - sinNeg30,
        getSuperclass().getStartY() - cosNeg30);// 30°
      shape.lineTo(getSuperclass().getCenterX(), getSuperclass().getStartY());
    } else {
      trianglePosition = Position.BOTTOM;
      shape.moveTo(getSuperclass().getCenterX(), getSuperclass().getEndY());
      shape.lineTo(getSuperclass().getCenterX() + sin30,
        getSuperclass().getEndY() + cos30);// 30°
      shape.lineTo(getSuperclass().getCenterX() + sinNeg30,
        getSuperclass().getEndY() + cosNeg30);// 30°
      shape.lineTo(getSuperclass().getCenterX(), getSuperclass().getEndY());
    }
  }
  try {
    shape.closePath();
  } catch (IllegalPathStateException e) {
    return super.getShape();
  }
  shape.append(super.getShape(), false);
  return shape;
}
 
开发者ID:onprom,项目名称:onprom,代码行数:51,代码来源:Inheritance.java


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