GraphStream Users

Archives de la liste Aide


Re: Mouse Clicks, JTabbedPanel Displacement and Labels with line breaks


Chronologique Discussions 
  • From: Antoine Dutot <antoine.dutot AT gmail.com>
  • To: Mauricio Carvalho <mauricio0copo AT gmail.com>, graphstream-users AT litislab.fr
  • Subject: Re: Mouse Clicks, JTabbedPanel Displacement and Labels with line breaks
  • Date: Wed, 29 May 2013 10:45:08 +0200

Hi,

Le mardi 28 mai 2013 à 23:08, Mauricio Carvalho a écrit :

For some reason, I can't reply via the mailing-list, so I'm doing it via gmail. 

1 - It works!! Thank you very much for your help!
:-) 

As you may have seen on another discussion on the list, be careful with this example, as it is intended to be augmented, not to be used as this.

2 - I'm posting what I converted so far to eclipse, with WindowsBuilder Pro. Got same results on both eclipse and netbeans:
View creation:
     viewer = new Viewer(graph, Viewer.ThreadingModel.GRAPH_IN_ANOTHER_THREAD);
     viewer.enableAutoLayout();
     view = viewer.addDefaultView(true);

JTabbedPane creation, which is a parameter of my main JFrame): 
     contentPane = new JPanel();
     contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  setContentPane(contentPane);
  contentPane.setLayout(new BorderLayout(0, 0));
  tabbedPane = new JTabbedPane(JTabbedPane.TOP);
  contentPane.add(tabbedPane);

Graphstream assignement to the pane:
     tabbedPane.add(xGraph.getView());    // this returns the graph.view
     tabbedPane.setSelectedIndex(1);
  tabbedPane.setTitleAt(1, "All Worlds");

When I add it directly to the JFrame or some JPanel (which is actually what I want - separated JPanels on the same JFrame containing different graphs), the problem is gone, but the view doesn't fit the whole JFrame - its size is the same of the default graphstream window, which opens as well (but containing nothing but a gray, empty JPanel).

When I change 
view = viewer.addDefaultView(true); to view = viewer.addDefaultView(false); nothing happens. The view ends up not being added to the frame.

By the way, I must add that the messages printed on the console (that shows the begin and end of a selection) show the correct coordinates.
Ok, I will try to investigate this, and reply to you as soon as I found the bug. I also created an issue on the tracker : https://github.com/graphstream/gs-core/issues/80
where I will post corrections when I find them (I hope so).

Regards,

Antoine 


2013/5/28 Antoine Dutot <antoine.dutot AT gmail.com>

Le mardi 28 mai 2013 à 16:46, mauricio0copo AT gmail.com a écrit :

1 - Yes, i created the loop (it's identical to the tutorial code). I tried just
copying/pasting the code on the tutorial, just to test it to see how it works,
but that code is not 'compilable'. The three last functions don't have any
declaration modifier nor class. I'm guessing it's implied that I had to know
which kind of declaration to use, but I'm not very knowledgeable about
listeners...
Yes, this was not intended as a full program, but I changed it so that the copy/paste in a your IDE should work. I let you add the import clauses :

import org.graphstream.graph.Graph;

import org.graphstream.graph.implementations.SingleGraph;

import org.graphstream.ui.swingViewer.Viewer;

import org.graphstream.ui.swingViewer.ViewerListener;

import org.graphstream.ui.swingViewer.ViewerPipe;


2 - It's a big code! I'm creating the windows with netbeans (migrating soon to
eclipse). Is it ok to post everything here? Or only the parts that make
references to the JTabbedPanel in question?
I would prefer a small part of the code, or something allowing me to reproduce it.  

3 - Oh, too bad... but thats ok. I'll find another alternative to display the
data on the label.

By the way, Thanks for the really quick reply!
:-)

Antoine 






Archives gérées par MHonArc 2.6.16.

Top of page