The examples issue. [message #246364] |
Wed, 26 November 2008 04:39  |
Eclipse User |
|
|
|
I run the example
public class GraphSnippet1 {
/**
* @param args
*/
public static void main(String[] args) {
// Create the shell
Display d = new Display();
Shell shell = new Shell(d);
shell.setText("GraphSnippet1");
shell.setLayout(new FillLayout());
shell.setSize(400, 400);
Graph g = new Graph(shell, SWT.NONE);
GraphNode n = new GraphNode(g, SWT.NONE, "Paper");
GraphNode n2 = new GraphNode(g, SWT.NONE, "Rock");
GraphNode n3 = new GraphNode(g, SWT.NONE, "Scissors");
new GraphConnection(g, SWT.NONE, n, n2);
new GraphConnection(g, SWT.NONE, n2, n3);
new GraphConnection(g, SWT.NONE, n3, n);
g.setLayoutAlgorithm(new
SpringLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING), true);
shell.open();
while (!shell.isDisposed()) {
while (!d.readAndDispatch()) {
d.sleep();
}
}
}
}
I find the dispose method of the Graph class do't call anyway, It make the
handle leak.
|
|
|
Re: The examples issue. [message #246380 is a reply to message #246364] |
Thu, 27 November 2008 03:13  |
Eclipse User |
|
|
|
gao wrote:
> I find the dispose method of the Graph class do't call anyway, It make the
> handle leak.
You'll need to call the #dispose() method yourself.
Add this at the very end of the file.
> shell.open();
> while (!shell.isDisposed()) {
> while (!d.readAndDispatch()) {
> d.sleep();
> }
> }
> }
// Destroy any SWT resources that you create here
g.dispose();
> }
|
|
|
Powered by
FUDForum. Page generated in 0.02732 seconds