Example usage for javax.swing JComponent print

List of usage examples for javax.swing JComponent print

Introduction

In this page you can find the example usage for javax.swing JComponent print.

Prototype

public void print(Graphics g) 

Source Link

Document

Invoke this method to print the component to the specified Graphics.

Usage

From source file:com.projity.pm.graphic.network.NetworkRenderer.java

public void paintNode(Graphics2D g, GraphicNode node) {
    Rectangle bounds = getBounds(node);
    if (isEditing(node)) {
        editor.paintEditor(node);//from   w ww. ja v  a2  s  .  c o m
    } else {
        JComponent c = renderer.getRendererComponent(node, ((NetworkParams) graphInfo).getZoom());
        if (container == null) {
            //c=new JLabel("test");
            c.setDoubleBuffered(false);
            c.setOpaque(false);
            c.setForeground(Color.BLACK);
            c.setSize(bounds.width, bounds.height);
            g.translate(bounds.x, bounds.y);
            c.doLayout();
            c.print(g);
            g.translate(-bounds.x, -bounds.y);
        } else
            rendererPane.paintComponent(g, c, container, bounds.x, bounds.y, bounds.width, bounds.height, true);
    }
}