KickJava   Java API By Example, From Geeks To Geeks.

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


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 JoinRenderer 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
20     // g.setColor(Color.lightGray);
21

22     if(super.isOpaque())
23     {
24       g.setColor(super.getBackground());
25       g.fillRect(b - 1, b - 1, d.width - b, d.height - b);
26     }
27     try
28     {
29       selected = false;
30       super.paint(g);
31     }
32     finally
33     {
34       selected = tmp;
35     }
36
37     if(bordercolor != null)
38     {
39       g.setColor(bordercolor);
40       g2.setStroke(new BasicStroke JavaDoc(b));
41       // g.drawRoundRect(b - 1, b - 1, d.width - b, d.height - b, arcw, arch);
42
g.drawRect(b - 1, b - 1, d.width - b, d.height - b);
43
44     }
45     if(selected)
46     {
47       g2.setStroke(GraphConstants.SELECTION_STROKE);
48       g.setColor(graph.getHighlightColor());
49       g.drawRect(b - 1, b - 1, d.width - b, d.height - b);
50     }
51   }
52
53 }
54
Popular Tags