本文整理汇总了Java中org.piccolo2d.extras.util.PFixedWidthStroke类的典型用法代码示例。如果您正苦于以下问题:Java PFixedWidthStroke类的具体用法?Java PFixedWidthStroke怎么用?Java PFixedWidthStroke使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PFixedWidthStroke类属于org.piccolo2d.extras.util包,在下文中一共展示了PFixedWidthStroke类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import org.piccolo2d.extras.util.PFixedWidthStroke; //导入依赖的package包/类
public void initialize() {
final PLayer layer = getCanvas().getLayer();
final PRoot root = getCanvas().getRoot();
final Random r = new Random();
for (int i = 0; i < 1000; i++) {
final PNode n = PPath.createRectangle(0, 0, 100, 80);
n.translate(10000 * r.nextFloat(), 10000 * r.nextFloat());
n.setPaint(new Color(r.nextFloat(), r.nextFloat(), r.nextFloat()));
layer.addChild(n);
}
getCanvas().getCamera().animateViewToCenterBounds(layer.getGlobalFullBounds(), true, 0);
final PActivity a = new PActivity(-1, 20) {
public void activityStep(final long currentTime) {
super.activityStep(currentTime);
rotateNodes();
}
};
root.addActivity(a);
final PPath p = new PPath.Float();
p.moveTo(0, 0);
p.lineTo(0, 1000);
final PFixedWidthStroke stroke = new PFixedWidthStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10,
new float[] { 5, 2 }, 0);
p.setStroke(stroke);
layer.addChild(p);
}
示例2: initialize
import org.piccolo2d.extras.util.PFixedWidthStroke; //导入依赖的package包/类
/** {@inheritDoc} */
public void initialize() {
final PText label = new PText("Stroke Example");
label.setFont(label.getFont().deriveFont(24.0f));
label.offset(20.0d, 20.0d);
final PPath rect = PPath.createRectangle(50.0f, 50.0f, 300.0f, 300.0f);
rect.setStroke(new BasicStroke(4.0f));
rect.setStrokePaint(new Color(80, 80, 80));
final PText fixedWidthLabel = new PText("PFixedWidthStrokes");
fixedWidthLabel.setTextPaint(new Color(80, 0, 0));
fixedWidthLabel.offset(100.0d, 80.0d);
final PPath fixedWidthRect0 = PPath.createRectangle(100.0f, 100.0f, 200.0f, 50.0f);
fixedWidthRect0.setStroke(new PFixedWidthStroke(2.0f));
fixedWidthRect0.setStrokePaint(new Color(60, 60, 60));
final PPath fixedWidthRect1 = PPath.createRectangle(100.0f, 175.0f, 200.0f, 50.0f);
fixedWidthRect1.setStroke(new PFixedWidthStroke(1.5f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 10.0f));
// fixedWidthRect1.setStroke(new PFixedWidthStroke(1.5f,
// PFixedWidthStroke.CAP_ROUND, PFixedWidthStroke.JOIN_MITER, 10.0f));
fixedWidthRect1.setStrokePaint(new Color(40, 40, 40));
final PPath fixedWidthRect2 = PPath.createRectangle(100.0f, 250.0f, 200.0f, 50.0f);
fixedWidthRect2.setStroke(new PFixedWidthStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 10.0f,
new float[] { 2.0f, 3.0f, 4.0f }, 1.0f));
// fixedWidthRect2.setStroke(new PFixedWidthStroke(1.0f,
// PFixedWidthStroke.CAP_ROUND, PFixedWidthStroke.JOIN_MITER, 10.0f, new
// float[] { 2.0f, 3.0f, 4.0f }, 1.0f));
fixedWidthRect2.setStrokePaint(new Color(20, 20, 20));
getCanvas().getLayer().addChild(label);
getCanvas().getLayer().addChild(rect);
getCanvas().getLayer().addChild(fixedWidthLabel);
getCanvas().getLayer().addChild(fixedWidthRect0);
getCanvas().getLayer().addChild(fixedWidthRect1);
getCanvas().getLayer().addChild(fixedWidthRect2);
}