Here is a simple "Hello World" example as a Cytoscape plugin where a Java Swing utility class is used to display the message in a dialog window.

   1 import javax.swing.JOptionPane;
   2 import cytoscape.plugin.CytoscapePlugin;
   3 import cytoscape.Cytoscape;
   4 
   5 public class HelloWorldPlugin extends CytoscapePlugin {
   6 
   7     public HelloWorldPlugin () {
   8         String message = "Hello World!";
   9         System.out.println(message);
  10         // use the CytoscapeDesktop as parent for a Swing dialog
  11         JOptionPane.showMessageDialog( Cytoscape.getDesktop(), message);
  12     }
  13 }
  14 

attachment:HelloWorld.java

attachment:HelloWorld.jar

Looking at the Plugin

Imports:

   1 import cytoscape.plugin.CytoscapePlugin;
   2 import cytoscape.Cytoscape;
   3 

Methods:

   1       public HelloWorldPlugin ()
   2 

To load this plugin into Cytoscape, save the jar file at the above link to your local disk in the Cytoscape plugins folder. Then start Cytoscape which will then load the plugin from the jar. You should see the "Hello World" dialog appear above your main Cytoscape window.

Funding for Cytoscape is provided by a federal grant from the U.S. National Institute of General Medical Sciences (NIGMS) of the Na tional Institutes of Health (NIH) under award number GM070743-01. Corporate funding is provided through a contract from Unilever PLC.

MoinMoin Appliance - Powered by TurnKey Linux