1

I am using graphstream with my swing application causing a lot of problem...

public class Clicks implements ViewerListener{
  protected boolean loop = true;
  public Clicks() {
    Graph graph = new SingleGraph("Clicks");
    graph.addNode("A");
    graph.addNode("ch");
    graph.addNode("2");
    Viewer viewer = graph.display();
    viewer.setCloseFramePolicy(Viewer.CloseFramePolicy.EXIT);
    ViewerPipe fromViewer = viewer.newViewerPipe();
    fromViewer.addViewerListener(this);
    fromViewer.addSink(graph);
    while(loop) {
        fromViewer.pump();
    }
  }
  public void viewClosed(String id) {
    loop = false;
  }
  public void buttonPushed(String id) {
    System.out.println("Button pushed on node "+id);
  }
  public void buttonReleased(String id) {
    System.out.println("Button released on node "+id);
  }
}

the above given class with main stand alone works fine but when i call the same class from button click event, the whole application halts...this is the button code

private void btnGraphStreamActionPerformed(java.awt.event.ActionEvent evt) 
{                                               
    new Clicks();
}
Gangaraju
  • 4,406
  • 9
  • 45
  • 77

0 Answers0