1 10 11 package org.enhydra.jawe.graph; 12 13 import org.enhydra.jawe.*; 14 import org.jgraph.graph.*; 15 import java.awt.*; 16 17 20 public class EndRenderer extends VertexRenderer { 21 22 private BasicStroke borderStroke = new BasicStroke(2); 23 24 28 public void paint(Graphics g){ 29 Color fillCol=Utils.getColor(JaWEConfig.getInstance().getEndColor()); 30 int b = borderWidth; 31 Graphics2D g2 = (Graphics2D) g; 32 Object AntiAlias = RenderingHints.VALUE_ANTIALIAS_ON; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, AntiAlias); Dimension d = getSize(); 35 boolean tmp = selected; 36 37 if (super.isOpaque()) { 38 g.setColor(fillCol); 39 g.fillOval(b-1, b-1, d.width-b, d.height-b); 40 } 41 try { 42 setBorder(null); 43 setOpaque(false); 44 selected = false; 45 super.paint(g); 46 } finally { 47 selected = tmp; 48 } 49 if (bordercolor != null) { 50 g.setColor(bordercolor); 51 g2.setStroke(borderStroke); 52 g.drawOval(b-1, b-1, d.width-b, d.height-b); 53 } 54 if (selected) { 55 g2.setStroke(GraphConstants.SELECTION_STROKE); 56 g.setColor(graph.getHighlightColor()); 57 g.drawOval(b-1, b-1, d.width-b, d.height-b); 58 } 59 } 60 61 } 62 | Popular Tags |