Java Code Examples for org.jgraph.graph.GraphConstants#setGradientColor()
The following examples show how to use
org.jgraph.graph.GraphConstants#setGradientColor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GraphVisitor.java From Pydev with Eclipse Public License 1.0 | 6 votes |
public DefaultGraphCell createVertex(String name, double x, double y, Color bg, boolean raised) { // Create vertex with the given name DefaultGraphCell cell = new DefaultGraphCell(name); GraphConstants.setBorder(cell.getAttributes(), BorderFactory.createEtchedBorder()); GraphConstants.setBounds(cell.getAttributes(), new Rectangle2D.Double(x, y, 10, 10)); GraphConstants.setResize(cell.getAttributes(), true); GraphConstants.setAutoSize(cell.getAttributes(), true); // Set fill color if (bg != null) { GraphConstants.setOpaque(cell.getAttributes(), true); GraphConstants.setGradientColor(cell.getAttributes(), bg); } // Set raised border if (raised) GraphConstants.setBorder(cell.getAttributes(), BorderFactory.createRaisedBevelBorder()); else // Set black border GraphConstants.setBorderColor(cell.getAttributes(), Color.black); return cell; }
Example 2
Source File: TableCell.java From MogwaiERDesignerNG with GNU General Public License v3.0 | 5 votes |
public TableCell(Table aTable) { super(aTable); GraphConstants.setBounds(getAttributes(), new Rectangle2D.Double(20, 20, 40, 20)); GraphConstants.setGradientColor(getAttributes(), Color.orange); GraphConstants.setOpaque(getAttributes(), false); GraphConstants.setAutoSize(getAttributes(), true); GraphConstants.setEditable(getAttributes(), true); addPort(); }
Example 3
Source File: ViewCell.java From MogwaiERDesignerNG with GNU General Public License v3.0 | 5 votes |
public ViewCell(View aTable) { super(aTable); GraphConstants.setBounds(getAttributes(), new Rectangle2D.Double(20, 20, 40, 20)); GraphConstants.setGradientColor(getAttributes(), Color.orange); GraphConstants.setOpaque(getAttributes(), false); GraphConstants.setAutoSize(getAttributes(), true); GraphConstants.setEditable(getAttributes(), true); addPort(); }
Example 4
Source File: AbstractGraphVertex.java From chipster with MIT License | 5 votes |
/** * Constructor for graph * * @param x * @param y * @param data * @param graph */ public AbstractGraphVertex(int x, int y, DataItem data, MicroarrayGraph graph) { super(data); this.graph = graph; this.setPosition(new Point(x,y)); GraphConstants.setGradientColor( this.getAttributes(), DEFAULT_VERTEX_COLOR); GraphConstants.setBorderColor( this.getAttributes(), Color.black); GraphConstants.setOpaque( this.getAttributes(), true); GraphConstants.setVerticalAlignment( this.getAttributes(), JLabel.TOP); Font font = GraphConstants.getFont(this.getAttributes()); font = font.deriveFont((float)font.getSize() + 3); GraphConstants.setFont(this.getAttributes(), font); }
Example 5
Source File: GraphVertex.java From chipster with MIT License | 4 votes |
/** * Creates a new graph vertex. The coordinates of the new vertex are * defined right and down from the upper left corner of the graph area. * The parent of the vertex is defined by the parent dataset of the * given data parameter. * * @param x Horizontal position of the new vertex (in pixel coordinates). * @param y Vertical position of the new vertex (in pixel coordinates). * @param data Dataset which this vertex is to represent on the graph. * @throws NullPointerException If the provided DataBean is null. */ public GraphVertex(int x, int y, DataBean data, MicroarrayGraph graph) { super(x, y, data, graph); children = new ArrayList<GraphVertex>(); Color c; if (data == null || data.getOperationRecord() == null || data.getOperationRecord().getCategoryColor() == null) { c = DEFAULT_VERTEX_COLOR; } else { c = data.getOperationRecord().getCategoryColor(); } GraphConstants.setGradientColor(this.getAttributes(),c); GraphConstants.setBackground(this.getAttributes(),c.brighter()); GraphConstants.setOpaque(this.getAttributes(), true); GraphConstants.setBorder(this.getAttributes(), BORDER_NORMAL); this.addPort(); this.graph = graph; try { Long rowCount = Session.getSession().getDataManager().getFastRowCount(data); if (rowCount != null) { if (rowCount < DataManager.MAX_ROWS_TO_COUNT) { tooltipText = ", " + rowCount + " rows"; } else { tooltipText = ", over " + rowCount + " rows"; } } else { tooltipText = ""; // too large file, maybe binary, cannot say anything } } catch (MicroarrayException e) { tooltipText = ""; } graph.getGraphLayoutCache().toFront(new Object[] { this } ); graph.repaint(); }