本文整理汇总了Java中com.mxgraph.examples.swing.editor.EditorPalette类的典型用法代码示例。如果您正苦于以下问题:Java EditorPalette类的具体用法?Java EditorPalette怎么用?Java EditorPalette使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EditorPalette类属于com.mxgraph.examples.swing.editor包,在下文中一共展示了EditorPalette类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: SchemaEditor
import com.mxgraph.examples.swing.editor.EditorPalette; //导入依赖的package包/类
/**
*
*/
public SchemaEditor()
{
super("mxGraph for JFC/Swing", new SchemaGraphComponent(new mxGraph()
{
/**
* Allows expanding tables
*/
public boolean isCellFoldable(Object cell, boolean collapse)
{
return model.isVertex(cell);
}
})
{
/**
*
*/
private static final long serialVersionUID = -1194463455177427496L;
/**
* Disables folding icons.
*/
public ImageIcon getFoldingIcon(mxCellState state)
{
return null;
}
});
// Creates a single shapes palette
EditorPalette shapesPalette = insertPalette("Schema");
graphOutline.setVisible(false);
mxCell tableTemplate = new mxCell("New Table", new mxGeometry(0, 0,
200, 280), null);
tableTemplate.getGeometry().setAlternateBounds(
new mxRectangle(0, 0, 140, 25));
tableTemplate.setVertex(true);
shapesPalette
.addTemplate(
"Table",
new ImageIcon(
GraphEditor.class
.getResource("/com/mxgraph/examples/swing/images/rectangle.png")),
tableTemplate);
getGraphComponent().getGraph().setCellsResizable(false);
getGraphComponent().setConnectable(false);
getGraphComponent().getGraphHandler().setCloneEnabled(false);
getGraphComponent().getGraphHandler().setImagePreview(false);
// Prefers default JComponent event-handling before mxCellHandler handling
//getGraphComponent().getGraphHandler().setKeepOnTop(false);
mxGraph graph = getGraphComponent().getGraph();
Object parent = graph.getDefaultParent();
graph.getModel().beginUpdate();
try
{
mxCell v1 = (mxCell) graph.insertVertex(parent, null, "Customers",
20, 20, 200, 280);
v1.getGeometry().setAlternateBounds(new mxRectangle(0, 0, 140, 25));
mxCell v2 = (mxCell) graph.insertVertex(parent, null, "Orders",
280, 20, 200, 280);
v2.getGeometry().setAlternateBounds(new mxRectangle(0, 0, 140, 25));
}
finally
{
graph.getModel().endUpdate();
}
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:76,代码来源:SchemaEditor.java
示例2: SchemaEditor
import com.mxgraph.examples.swing.editor.EditorPalette; //导入依赖的package包/类
/**
*
*/
public SchemaEditor() {
super("mxGraph for JFC/Swing", new SchemaGraphComponent(new mxGraph() {
/**
* Allows expanding tables
*/
public boolean isCellFoldable(Object cell, boolean collapse) {
return model.isVertex(cell);
}
})
{
/**
*
*/
private static final long serialVersionUID = -1194463455177427496L;
/**
* Disables folding icons.
*/
public ImageIcon getFoldingIcon(mxCellState state) {
return null;
}
});
// Creates a single shapes palette
EditorPalette shapesPalette = insertPalette("Schema");
graphOutline.setVisible(false);
mxCell tableTemplate = new mxCell("New Table", new mxGeometry(0, 0, 200, 280), null);
tableTemplate.getGeometry().setAlternateBounds(new mxRectangle(0, 0, 140, 25));
tableTemplate.setVertex(true);
shapesPalette.addTemplate("Table",
new ImageIcon(
GraphEditor.class.getResource("/com/mxgraph/examples/swing/images/rectangle.png")),
tableTemplate);
getGraphComponent().getGraph().setCellsResizable(false);
getGraphComponent().setConnectable(false);
getGraphComponent().getGraphHandler().setCloneEnabled(false);
getGraphComponent().getGraphHandler().setImagePreview(false);
// Prefers default JComponent event-handling before mxCellHandler handling
// getGraphComponent().getGraphHandler().setKeepOnTop(false);
mxGraph graph = getGraphComponent().getGraph();
Object parent = graph.getDefaultParent();
graph.getModel().beginUpdate();
try {
mxCell v1 = (mxCell) graph.insertVertex(parent, null, "Customers", 20, 20, 200, 280);
v1.getGeometry().setAlternateBounds(new mxRectangle(0, 0, 140, 25));
mxCell v2 = (mxCell) graph.insertVertex(parent, null, "Orders", 280, 20, 200, 280);
v2.getGeometry().setAlternateBounds(new mxRectangle(0, 0, 140, 25));
} finally {
graph.getModel().endUpdate();
}
}
开发者ID:ModelWriter,项目名称:Tarski,代码行数:62,代码来源:SchemaEditor.java
注:本文中的com.mxgraph.examples.swing.editor.EditorPalette类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论