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 StartRenderer 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().getStartColor()); 30 31 int b = borderWidth; 32 Graphics2D g2 = (Graphics2D) g; 33 Object AntiAlias = RenderingHints.VALUE_ANTIALIAS_ON; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, AntiAlias); Dimension d = getSize(); 36 boolean tmp = selected; 37 38 if (super.isOpaque()) { 39 g.setColor(fillCol); 40 g.fillOval(b-1, b-1, d.width-b, d.height-b); 41 } 42 try { 43 setBorder(null); 44 setOpaque(false); 45 selected = false; 46 super.paint(g); 47 } finally { 48 selected = tmp; 49 } 50 if (bordercolor != null) { 51 g.setColor(bordercolor); 52 g2.setStroke(borderStroke); 53 g.drawOval(b-1, b-1, d.width-b, d.height-b); 54 } 55 if (selected) { 56 g2.setStroke(GraphConstants.SELECTION_STROKE); 57 g.setColor(graph.getHighlightColor()); 58 g.drawOval(b-1, b-1, d.width-b, d.height-b); 59 } 60 } 61 } 62 | Popular Tags |