KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > designer > views > InitialActionRenderer


1 package com.opensymphony.workflow.designer.views;
2
3 import java.awt.BasicStroke JavaDoc;
4 import java.awt.Dimension JavaDoc;
5 import java.awt.Graphics JavaDoc;
6 import java.awt.Graphics2D JavaDoc;
7
8 import org.jgraph.graph.GraphConstants;
9 import org.jgraph.graph.VertexRenderer;
10
11 public class InitialActionRenderer extends VertexRenderer
12 {
13   public void paint(Graphics JavaDoc g)
14   {
15     int b = borderWidth;
16     Graphics2D JavaDoc g2 = (Graphics2D JavaDoc)g;
17     Dimension JavaDoc d = getSize();
18     boolean tmp = selected;
19     if(super.isOpaque())
20     {
21       g.setColor(super.getBackground());
22       g.fillOval(b - 1, b - 1, d.width - b, d.height - b);
23     }
24     try
25     {
26       setBorder(null);
27       setOpaque(false);
28       selected = false;
29       super.paint(g);
30     }
31     finally
32     {
33       selected = tmp;
34     }
35     if(bordercolor != null)
36     {
37       g.setColor(bordercolor);
38       g2.setStroke(new BasicStroke JavaDoc(b));
39       g.drawOval(b - 1, b - 1, d.width - b, d.height - b);
40     }
41     if(selected)
42     {
43       g2.setStroke(GraphConstants.SELECTION_STROKE);
44       g.setColor(graph.getHighlightColor());
45       g.drawOval(b - 1, b - 1, d.width - b, d.height - b);
46     }
47   }
48 }
49
Popular Tags