本文整理汇总了Java中org.jgraph.graph.GraphConstants.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java GraphConstants.setBackground方法的具体用法?Java GraphConstants.setBackground怎么用?Java GraphConstants.setBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jgraph.graph.GraphConstants
的用法示例。
在下文中一共展示了GraphConstants.setBackground方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setAttributes
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
/**
* Sets all the attributes like background colour, dimensions, port number
* & position
*
* @param pt
* @return created map
*/
public Hashtable<Object, Map> setAttributes(Point2D pt, JGraph graph) {
//contains attributes of the cell & ports
Hashtable<Object, Map> nest = new Hashtable<Object, Map>();
Dimension cellDimension = getSize(graph);
//contains attributes of the cell
Map attr = getAttributes();
GraphConstants.setBounds(attr, new Rectangle2D.Double(pt.getX(), pt.getY(), cellDimension.getWidth(), cellDimension.getHeight()));
GraphConstants.setEditable(attr, false);
GraphConstants.setBackground(attr, graph.getBackground());
nest.put(this, attr);
//create ports
ports = createPorts();
Icon icon = GraphConstants.getIcon(attr);
updatePortPositions(nest, icon, cellDimension);
for (Port port : ports) {
add((DefaultPort) port);
}
return nest;
}
示例2: setAttributes
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
/**
* Sets all the attribults like background colour, dimensions, port number
* & position
* @param pt
* @return created map
*/
public Hashtable<Object, Map> setAttributes(Point2D pt, JGraph graph) {
//contains attribute of the cell & ports
Hashtable<Object, Map> nest = new Hashtable<Object, Map>();
Dimension cellDimension = getSize(graph);
//contains attrib of cell
Map attr = getAttributes();
GraphConstants.setBounds(attr, new Rectangle2D.Double(pt.getX(), pt.getY(), cellDimension.getWidth(), cellDimension.getHeight()));
GraphConstants.setEditable(attr, false);
GraphConstants.setBackground(attr, graph.getBackground());
nest.put(this, attr);
//create ports
ports = createPorts();
Icon icon = GraphConstants.getIcon(attr);
updatePortPositions(nest, icon, cellDimension);
for (Port port : ports) {
add((DefaultPort) port);
}
return nest;
}
示例3: createBounds
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public static Map createBounds(AttributeMap map, double x, double y, Dimension dimension, Color c, boolean moveable)
{
// final int ALPHA = 255;
GraphConstants.setBounds(map, map.createRect(x, y, dimension.getWidth(), dimension.getHeight()));
// GraphConstants.setBorder(map, BorderFactory.createBevelBorder(BevelBorder.RAISED));
GraphConstants.setForeground(map, Color.BLACK.darker().darker());//new Color(ALPHA - c.getRed(), ALPHA - c.getGreen(), ALPHA - c.getBlue(), ALPHA));
GraphConstants.setBackground(map, c.darker());
// Add a nice looking gradient background
GraphConstants.setGradientColor(map, c.darker());
// Make sure the cell is resized on insert
// GraphConstants.setSize();
// GraphConstants.setResize(map, true);
// Add a Border Color Attribute to the Map
GraphConstants.setBorderColor(map, Color.BLACK.darker().darker());
GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
GraphConstants.setMoveable(map, moveable);
GraphConstants.setOpaque(map, true);
GraphConstants.setResize(map, false);
GraphConstants.setAutoSize(map, true);
return map;
}
示例4: createBounds
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public static Map createBounds(AttributeMap map, double x, double y, Dimension dimension, Color c, boolean moveable)
{
// final int ALPHA = 255;
GraphConstants.setBounds(map, map.createRect(x, y, dimension.getWidth(), dimension.getHeight()));
// GraphConstants.setBorder(map, BorderFactory.createBevelBorder(BevelBorder.RAISED));
GraphConstants.setForeground(map, Color.BLACK.darker().darker());//new Color(ALPHA - c.getRed(), ALPHA - c.getGreen(), ALPHA - c.getBlue(), ALPHA));
GraphConstants.setBackground(map, c.darker());
// Add a nice looking gradient background
GraphConstants.setGradientColor(map, c.darker());
// Make sure the cell is resized on insert
// GraphConstants.setSize();
// GraphConstants.setResize(map, true);
// Add a Border Color Attribute to the Map
GraphConstants.setBorderColor(map, Color.BLACK.darker().darker());
GraphConstants.setFont(map, GraphConstants.DEFAULTFONT.deriveFont(Font.BOLD, 12));
GraphConstants.setMoveable(map, moveable);
GraphConstants.setOpaque(map, true);
GraphConstants.setResize(map, false);
GraphConstants.setAutoSize(map, true);
return map;
}
示例5: adjustLayout
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
private static void adjustLayout(FeatureDefinitionEntry feature, @Nullable Color bg) {
DefaultGraphCell cell = _featureGraphModelAdapter.getVertexCell(feature);
GraphConstants.setBounds(cell.getAttributes(), new Rectangle2D.Double(25, 25, 200, 20));
GraphConstants.setAutoSize(cell.getAttributes(), true);
if (bg != null) {
GraphConstants.setBackground(cell.getAttributes(), bg);
GraphConstants.setOpaque(cell.getAttributes(), true);
}
GraphConstants.setBorderColor(cell.getAttributes(), Color.black);
cell.addPort();
}
示例6: PlaceGraphCell
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public PlaceGraphCell(int id, int posX, int posY) {
super("P" + id, posX, posY);
GraphConstants.setBackground(getAttributes(), Color.ORANGE);
GraphConstants.setFont(getAttributes(), FONT);
}
示例7: TransitionGraphCell
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
public TransitionGraphCell(int id, int posX, int posY) {
super("T" + id, posX, posY);
GraphConstants.setBackground(getAttributes(), Color.CYAN);
GraphConstants.setFont(getAttributes(), FONT);
}
示例8: GraphVertex
import org.jgraph.graph.GraphConstants; //导入方法依赖的package包/类
/**
* 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();
}