File: MyCellModelEditor.java

package info (click to toggle)
libjgraph-java 5.12.4.2%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 7,884 kB
  • ctags: 7,321
  • sloc: java: 20,619; xml: 135; sh: 51; makefile: 10
file content (34 lines) | stat: -rw-r--r-- 1,012 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.jgraph.example.mycellmodeleditor;

import javax.swing.JFrame;

import org.jgraph.JGraph;
import org.jgraph.graph.AbstractCellView;

/**
 * Try to edit cells. Remark that the cell label is not necessarly coupled with
 * the graph cell user object.
 * Tip: use F2 to edit groups!
 * 
 * This example shows how one can set up a custom Swing component to in place
 * edit cells and also how the cell user object can be decorrellated from the
 * cell label.
 * 
 * @author rvalyi
 */
public class MyCellModelEditor {

	public static void main(String[] args) {
		// Switch off D3D because of Sun XOR painting bug
		// See http://www.jgraph.com/forum/viewtopic.php?t=4066
		System.setProperty("sun.java2d.d3d", "false");
		JFrame frame = new JFrame("MyCellModelEditor");
		JGraph graph = new JGraph();
		frame.getContentPane().add(graph);
		BusinessObjectEditor.editorInsideCell = false;
		AbstractCellView.cellEditor = new BusinessObjectEditor();

		frame.setSize(700, 500);
		frame.setVisible(true);
	}
}