简体   繁体   中英

setToolTip in JUNG for several vertices

I have nearly 36 vertiecs in one graph.I would like to insert tooltip box for each and every vertices. I have to show further information about the vertices with the help of tooltip box.

 vv.setToolTipText("<html><center>Breast Neoplasms<p>"+ "Gene interactions</p> </center></html>");

The above code is for displaying general information. But i need tooltip for every vertices in my graph. Can anyone help me with this?

I got the required output uisng the following code.

  vv.setVertexToolTipTransformer(new Transformer<String, String>() {
        public String transform(String v) {

        //  i=0;
            try {

                 String bb = "SELECT * FROM interr";
                Statement pest = connection.createStatement();
                ResultSet v1 = pest.executeQuery(bb);   
                while(v1.next())
                    if(v.toString().equals(v1.getString("Mole1")))
                 na[i] = v1.getString("Pubchem_ID");
                System.out.println(na[i]);
                v=na[i].toString();
                return "PUBMED:"+v.toString();
            }
        catch (Exception e1) {
            JOptionPane.showMessageDialog(null, e1);

        }
            return null;

        }
    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM