RE: Java Code Syntax to Maximise Network Window

45 views
Skip to first unread message

Alvin

unread,
Apr 30, 2012, 10:27:45 PM4/30/12
to cytoscap...@googlegroups.com
Hi,

I would like to enquire on the Java code syntax to maximise the current network window.
Currently I have tried this code but it only resizes my graph and not the network window.

CyNetworkView view = Cytoscape.getCurrentNetworkView();
((DGraphView) view).getCanvas().setSize(500, 500); 

Thanks.

Tim te Beek

unread,
May 1, 2012, 6:13:17 AM5/1/12
to cytoscap...@googlegroups.com
Hi Alvin,

I think it's made the mailinglist before, but here it is again:

CyNetworkView networkView = Cytoscape.getCurrentNetworkView();
try {
NetworkViewManager networkViewManager = Cytoscape.getDesktop().getNetworkViewManager();
JInternalFrame internalFrame = networkViewManager.getInternalFrame(networkView);
internalFrame.setMaximum(true);
}
catch (IllegalArgumentException e) {
e.printStackTrace();
}
catch (PropertyVetoException e) {
e.printStackTrace();
}

Best,
Tim

Alvin

unread,
May 1, 2012, 9:31:05 AM5/1/12
to cytoscap...@googlegroups.com
Thanks Tim, it worked!

Can I enquire on how to zoom in the nodes programmatically to match the size of the maximised network window?
Currently the code cause the network window to expand but the nodes remain as the size suited to the unmaximized network window.

Thanks. 

Tim te Beek

unread,
May 1, 2012, 10:09:20 AM5/1/12
to cytoscap...@googlegroups.com
Hi Alvin,

Nice to hear that worked for you as well.

I've not looked into resizing the nodes to fit the new maximized state, but would be interested in that code as well if I came across it. If you or someone else figures it out please share it here.

Best,
Tim

Peng-Liang Wang

unread,
May 1, 2012, 4:20:36 PM5/1/12
to cytoscap...@googlegroups.com
The CyNetworkView should have the method fitContent() -- Fits all
Viewable elements onto the Graph.

Peng
> --
> You received this message because you are subscribed to the Google Groups
> "cytoscape-discuss" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/cytoscape-discuss/-/szXV-Wg9QisJ.
>
> To post to this group, send email to cytoscap...@googlegroups.com.
> To unsubscribe from this group, send email to
> cytoscape-disc...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/cytoscape-discuss?hl=en.

Alvin

unread,
May 2, 2012, 8:14:37 AM5/2/12
to cytoscap...@googlegroups.com
Thanks, it worked. 

I have another question.
Is there a method available to adjust the distance between nodes both horizontally and vertically upon loading?

Thanks.
> To post to this group, send email to cytoscape-discuss@googlegroups.com.
> To unsubscribe from this group, send email to
Reply all
Reply to author
Forward
0 new messages