• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PText类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: initialize

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
public void initialize() {
    final PComposite composite = new PComposite();

    final PNode circle = PPath.createEllipse(0, 0, 100, 100);
    final PNode rectangle = PPath.createRectangle(50, 50, 100, 100);
    final PNode text = new PText("Hello world!");

    composite.addChild(circle);
    composite.addChild(rectangle);
    composite.addChild(text);

    rectangle.rotate(Math.toRadians(45));
    rectangle.setPaint(Color.RED);

    text.scale(2.0);
    text.setPaint(Color.GREEN);

    getCanvas().getLayer().addChild(composite);
    getCanvas().removeInputEventListener(getCanvas().getPanEventHandler());
    getCanvas().addInputEventListener(new PDragEventHandler());
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:22,代码来源:CompositeExample.java


示例2: createNode

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
/**
 * Creates a {@link PPath} object as a rectangle that has rounded corners.
 *
 * @param text
 *            the {@link PText} object
 * @return a {@link PPath} object
 */
public static PPath createNode(PText text) {
	return PPath.createRoundRectangle(-5
			- 0.5F
					* (float) text.getWidth(), // x
			-5
					- 0.5F
							* (float) text.getHeight(), // y
			(float) text.getWidth()
					+ mOffsetWidth, // width + offset
			(float) text.getHeight()
					+ mOffsetHeight, // height + offset
			mArcWidth, // arcWidth
			mArcHeight // arcHeight
	);
}
 
开发者ID:trustathsh,项目名称:visitmeta,代码行数:23,代码来源:RectanglesWithRoundedCornersPiccolo2dNodeRenderer.java


示例3: createNode

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
@Override
public PPath createNode(Identifier identifier, PText text) {
	IdentifierWrapper wrapper = IdentifierHelper.identifier(identifier);
	String typeName = wrapper.getTypeName();
	switch (typeName) {
		case IfmapStrings.IDENTITY_EL_NAME:
			if (ExtendedIdentifierHelper.isExtendedIdentifier(identifier)) {
				String extendedIdentifierTypeName =
						ExtendedIdentifierHelper.getExtendedIdentifierInnerTypeName(identifier);
				if (extendedIdentifierTypeName.equals("service")) {
					return EllipsePiccolo2dNodeRenderer.createNode(text);
				}
			}
		case IfmapStrings.ACCESS_REQUEST_EL_NAME:
		case IfmapStrings.DEVICE_EL_NAME:
		case IfmapStrings.IP_ADDRESS_EL_NAME:
		case IfmapStrings.MAC_ADDRESS_EL_NAME:
		default:
			return RectanglesWithRoundedCornersPiccolo2dNodeRenderer.createNode(text);
	}
}
 
开发者ID:trustathsh,项目名称:visitmeta,代码行数:22,代码来源:ExamplePiccolo2dNodeRenderer.java


示例4: createNode

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
/**
 * Creates a new {@link PPath} object as a ellipse.
 *
 * @param text
 *            the {@link PText} object
 * @return a {@link PPath} object
 */
public static PPath createNode(PText text) {
	PBounds bounds = text.getFullBoundsReference();
	float width = (float) (bounds.getWidth()
			+ mGlowWidth);
	float height = (float) (bounds.getHeight()
			+ mGlowHeight);

	PPath result = PPath.createEllipse(-0.5F
			* width, // x
			-0.5F
					* height, // y
			width, // width
			height // height
	);

	return result;
}
 
开发者ID:trustathsh,项目名称:visitmeta,代码行数:25,代码来源:EllipsePiccolo2dNodeRenderer.java


示例5: mouseEntered

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
@Override
public void mouseEntered(PInputEvent e) {
	LOGGER.trace("Method mouseEntered("
			+ e + ") called.");
	super.mouseEntered(e);

	if (!mConnection.isPropablePicked()) {
		PNode pickedNode = e.getPickedNode();
		if (pickedNode instanceof PComposite) {
			PPath vNode = (PPath) pickedNode.getChild(0);
			PText vText = (PText) pickedNode.getChild(1);
			GraphicWrapper wrapper = Piccolo2DGraphicWrapperFactory.create(vNode, vText);
			mConnection.showProperty(wrapper.getData());
			mPanel.mouseEntered(wrapper);
		}
	}
}
 
开发者ID:trustathsh,项目名称:visitmeta,代码行数:18,代码来源:NodeEventHandler.java


示例6: mouseClicked

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
@Override
public void mouseClicked(PInputEvent e) {
	LOGGER.trace("Method mouseClicked ("
			+ e + ") called.");
	super.mouseClicked(e);

	PNode pickedNode = e.getPickedNode();
	if (e.isLeftMouseButton()) {
		if (pickedNode instanceof PComposite) {
			PPath vNode = (PPath) pickedNode.getChild(0);
			PText vText = (PText) pickedNode.getChild(1);
			GraphicWrapper wrapper = Piccolo2DGraphicWrapperFactory.create(vNode, vText);
			mConnection.pickAndShowProperties(wrapper);
		} else {
			mConnection.clearProperties();
		}
	}
}
 
开发者ID:trustathsh,项目名称:visitmeta,代码行数:19,代码来源:NodeEventHandler.java


示例7: adjustPanelSize

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
/**
 * Adjust the size of the panel depending on the number and size of labels.
 */
@Override
public synchronized void adjustPanelSize() {
	LOGGER.trace("Method adjustPanelSize() called.");
	int vNumberOfNodes = mMapNode.size();
	int vNumberOfChars = 0;
	if (vNumberOfNodes > 0) {
		for (PComposite vNode : mMapNode.values()) {
			vNumberOfChars += ((PText) vNode.getChild(1)).getText()
					.length();
		}
		double vAverage = vNumberOfChars
				/ vNumberOfNodes;
		double vSize = (Math.sqrt(vNumberOfNodes)
				+ vAverage)
				* 50;
		mAreaHeight = vSize;
		mAreaWidth = vSize;
	}
}
 
开发者ID:trustathsh,项目名称:visitmeta,代码行数:23,代码来源:Piccolo2DPanel.java


示例8: repaintNodes

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
@Override
public synchronized void repaintNodes(NodeType pType) {
	LOGGER.trace("Method repaintNodes("
			+ pType + ") called.");
	for (Object key : mMapNode.keySet()) {
		PComposite vCom = mMapNode.get(key);
		PPath vNode = (PPath) vCom.getChild(0);
		PText vText = (PText) vCom.getChild(1);

		if (pType == NodeType.IDENTIFIER) {
			if (vCom.getAttribute("type").equals(pType)) {
				NodeIdentifier i = (NodeIdentifier) key;
				Identifier identifier = i.getIdentifier();
				paintIdentifierNode(identifier, vNode, vText);
			}
		} else if (pType == NodeType.METADATA) {
			if (vCom.getAttribute("type").equals(pType)) {
				NodeMetadata m = (NodeMetadata) key;
				Metadata metadata = m.getMetadata();
				paintMetadataNode(metadata, vNode, vText);
			}
		}
	}
}
 
开发者ID:trustathsh,项目名称:visitmeta,代码行数:25,代码来源:Piccolo2DPanel.java


示例9: create

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
/**
 * Creates a new {@link Piccolo2DGraphicWrapper}.
 *
 * @param selectedNode the {@link PPath} of the selected node
 * @param selectedNodeText the {@link PText} of the selected node
 * @return a new {@link Piccolo2DGraphicWrapper}
 */
public static Piccolo2DGraphicWrapper create(PPath selectedNode, PText selectedNodeText) {
	String typeName = getTypeName(selectedNode);

	if (typeName == null) {
		return new Piccolo2DGraphicWrapper(selectedNode, selectedNodeText);
	}

	switch (typeName) {
		case "policy-action":
			return new Piccolo2DPolicyActionGraphicWrapper(selectedNode, selectedNodeText);
		case "identity":
			return new Piccolo2DIdentityGraphicWrapper(selectedNode, selectedNodeText);
		default:
			return new Piccolo2DGraphicWrapper(selectedNode, selectedNodeText);
	}
}
 
开发者ID:trustathsh,项目名称:visitmeta,代码行数:24,代码来源:Piccolo2DGraphicWrapperFactory.java


示例10: getNodes

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public List<GraphicWrapper> getNodes() {
	ArrayList<PComposite> nodes = (ArrayList<PComposite>) mNode.getAttribute("nodes");
	List<GraphicWrapper> edgesNodes = new ArrayList<GraphicWrapper>();
	if (nodes != null) {
		for (PComposite vCom : nodes) {
			PPath vNode = (PPath) vCom.getChild(0);
			PText vText = (PText) vCom.getChild(1);

			GraphicWrapper g = Piccolo2DGraphicWrapperFactory.create(vNode, vText);
			edgesNodes.add(g);
		}
	}
	return edgesNodes;
}
 
开发者ID:trustathsh,项目名称:visitmeta,代码行数:17,代码来源:Piccolo2DGraphicWrapper.java


示例11: createNodeUsingExistingClasses

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
public void createNodeUsingExistingClasses() {
    final PLayer layer = getCanvas().getLayer();
    layer.addChild(PPath.createEllipse(0, 0, 100, 100));
    layer.addChild(PPath.createRectangle(0, 100, 100, 100));
    layer.addChild(new PText("Hello World"));

    // Here we create an image node that displays a thumbnail
    // image of the root node. Note that you can easily get a thumbnail
    // of any node by using PNode.toImage().
    final PImage image = new PImage(layer.toImage(300, 300, null));
    layer.addChild(image);
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:13,代码来源:NodeExample.java


示例12: initialize

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
/** {@inheritDoc} */
public void initialize() {
    PText label = new PText("Note white at border S and E\nIt goes away when frame is resized");
    label.setOffset(200, 340);
    getCanvas().getLayer().addChild(label);
    getCanvas().setBackground(Color.PINK);
    getCanvas().setOpaque(true);
    setSize(410, 410);
    //getCanvas().setSize(410, 410);  does not help
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:11,代码来源:FrameCanvasSizeBugExample.java


示例13: createNodeUsingExistingClasses

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
public void createNodeUsingExistingClasses() {
    final PLayer layer = getCanvas().getLayer();
    layer.addChild(PPath.createEllipse(0, 0, 100, 100));
    layer.addChild(PPath.createRectangle(0, 100, 100, 100));
    layer.addChild(new PText("Hello World"));

    // Here we create an image node that displays a thumbnail
    // image of the root node. Note that you can easily get a thumbnail
    // of any node by using PNode.toImage().
    layer.addChild(new PImage(layer.toImage(300, 300, Color.YELLOW)));
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:12,代码来源:BirdsEyeViewExample.java


示例14: createTextNode

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
private void createTextNode(final int i) {
    PText text = new PText("Label " + i);
    text.setTextPaint(TEXT_PAINT);
    text.setOffset(random.nextDouble() * 1000.0d - random.nextDouble() * 1000.0,
                   random.nextDouble() * 1000.0d - random.nextDouble() * 1000.0);
    getCanvas().getLayer().addChild(text);
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:8,代码来源:MouseWheelZoomExample.java


示例15: OffscreenCanvasExample

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
/**
 * Create a new offscreen canvas example with the specified graphics device.
 * 
 * @param device graphics device
 */
public OffscreenCanvasExample(final GraphicsDevice device) {
    final GraphicsConfiguration configuration = device.getDefaultConfiguration();
    frame = new Frame(configuration);
    frame.setUndecorated(true);
    frame.setIgnoreRepaint(true);
    frame.setBounds(100, 100, 400, 400);
    frame.setVisible(true);
    frame.createBufferStrategy(2);

    canvas = new POffscreenCanvas(400, 400);

    final PText text = new PText("Offscreen Canvas Example");
    text.setFont(text.getFont().deriveFont(32.0f));
    text.setTextPaint(new Color(200, 200, 200));
    text.offset(200.0f - text.getWidth() / 2.0f, 200.0f - text.getHeight() / 2.0f);

    final PPath rect = PPath.createRectangle(0.0f, 0.0f, 360.0f, 360.0f);
    rect.setPaint(new Color(20, 20, 20, 80));
    rect.setStroke(new BasicStroke(2.0f));
    rect.setStrokePaint(new Color(20, 20, 20));
    rect.offset(20.0f, 20.0f);

    canvas.getCamera().getLayer(0).addChild(text);
    canvas.getCamera().getLayer(0).addChild(rect);

    final Rectangle2D right = new Rectangle2D.Double(200.0f, 200.0f, 800.0f, 800.0f);
    final Rectangle2D left = new Rectangle2D.Double(-200.0f, 200.0f, 225.0f, 225.0f);
    final Rectangle2D start = new Rectangle2D.Double(0.0f, 0.0f, 400.0f, 400.0f);
    final PActivity toRight = canvas.getCamera().animateViewToCenterBounds(right, true, 5000);
    final PActivity toLeft = canvas.getCamera().animateViewToCenterBounds(left, true, 5000);
    final PActivity toStart = canvas.getCamera().animateViewToCenterBounds(start, true, 5000);
    toLeft.startAfter(toRight);
    toStart.startAfter(toLeft);
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:40,代码来源:OffscreenCanvasExample.java


示例16: initialize

import org.piccolo2d.nodes.PText; //导入依赖的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);
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:40,代码来源:StrokeExample.java


示例17: initialize

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
public void initialize() {
    String text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit posuere.";
    PText ptext = new PText(text);
    ptext.setPaint(Color.GRAY);
    ptext.setBounds(0.0d, 10.0d, 600.0d, 40.0d);
    ptext.offset(0.0d, 50.0d);
    
    PHtmlView phtmlView = new PHtmlView(text);
    phtmlView.setPaint(Color.GRAY);
    phtmlView.setBounds(0.0d, 10.0d, 600.0d, 40.0d);
    phtmlView.offset(0.0d, 150.0d);

    PStyledText pstyledText = new PStyledText();
    Document document = new DefaultStyledDocument();
    try {
        document.insertString(0, text, null);
    }
    catch (BadLocationException e) {
        // ignore
    }
    pstyledText.setDocument(document);
    pstyledText.setPaint(Color.GRAY);
    pstyledText.setBounds(0.0d, 10.0d, 600.0d, 40.0d);
    pstyledText.offset(0.0d, 250.0d);

    getCanvas().getLayer().addChild(ptext);
    getCanvas().getLayer().addChild(phtmlView);
    getCanvas().getLayer().addChild(pstyledText);
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:30,代码来源:TextOffsetBoundsExample.java


示例18: testClone

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
public void testClone() {
    textNode.setTextPaint(Color.BLUE);
    textNode.setText("Boo");
    final PText clonedNode = (PText) textNode.clone();
    assertEquals("Boo", clonedNode.getText());
    assertEquals(textNode.getFont(), clonedNode.getFont());
    assertEquals(Color.BLUE, clonedNode.getTextPaint());
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:9,代码来源:PTextTest.java


示例19: testSetFontFiresPropertyChangedEvent

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
public void testSetFontFiresPropertyChangedEvent() {
    textNode.addPropertyChangeListener(PText.PROPERTY_FONT, mockListener);
    final Font newFont = new Font("Arial", Font.BOLD, 10);
    textNode.setFont(newFont);

    assertEquals(1, mockListener.getPropertyChangeCount());
    assertEquals(PText.PROPERTY_FONT, mockListener.getPropertyChange(0).getPropertyName());
}
 
开发者ID:piccolo2d,项目名称:piccolo2d.java,代码行数:9,代码来源:PTextTest.java


示例20: initialize

import org.piccolo2d.nodes.PText; //导入依赖的package包/类
public void initialize() {
    PNode textNode = new PText("Hello CodeJava!");     
    textNode.setX(getCanvas().getWidth()/2-textNode.getWidth()/2);
    textNode.setY(getCanvas().getHeight()/2-textNode.getHeight()/2);
    textNode.addInputEventListener(new ScrollZoom());
    getCanvas().getLayer().addChild(textNode);
}
 
开发者ID:clearlyspam23,项目名称:JAnGLE,代码行数:8,代码来源:ZoomableTextDemo.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ODataLibraryException类代码示例发布时间:2022-05-22
下一篇:
Java FileURL类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap