Open Jgraph Problem

Open Jgraph Problem

Hi,

I have go through the example given in http://sourceforge.net/projects/openjgraph/ for Open Jgraph by Jesus M. Salvo Jr. I have amended one of the sample (SampleTreeLayout.java) codes as below:

package examples;
import salvo.jesus.graph.;
import salvo.jesus.graph.visual.;
import salvo.jesus.graph.visual.layout.;
import salvo.jesus.graph.visual.drawing.;
import java.awt.;
import java.awt.event.;
import javax.swing.;
import java.awt.geom.;
/
@author Jesus M. Salvo Jr.
/

public class SampleTreeLayout extends JFrame {
VisualGraph vgraph;

public SampleTreeLayout() {}

private Tree initTree() throws Exception {
Tree tree = new TreeImpl();
Vertex v1, v2, v3, v4 ;

v1 = new VertexImpl( "1" );
v2 = new VertexImpl( "2" );
v3 = new VertexImpl( "3" );
v4 = new VertexImpl( "4" );


tree.addNode( null, v1 );
tree.addNode( v1, v2 );
tree.addNode( v2, v3 );
tree.addNode( v3, v4 );

return tree;
}

private void showTree( Tree tree ) {
GraphEditor editor;
GraphLayoutManager layoutManager;

// Get a VisualGraph
editor = new GraphEditor();
editor.setGraph( tree );
vgraph = editor.getVisualGraph();

// Initialise a Tree layout manager
layoutManager = new LayeredTreeLayout( editor.getVisualGraph() );
editor.setGraphLayoutManager( layoutManager );

// Make it all visible
this.getContentPane().setLayout( new GridLayout(1,2));
this.getContentPane().add( editor );

Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = new Dimension( screenSize.width - 50, screenSize.height - 50 );

this.setSize( frameSize );
this.setLocation((int)(screenSize.getWidth() - frameSize.getWidth()) / 2, (int)(screenSize.getHeight() - frameSize.getHeight()) / 2);

// Terminate the application when the window closes
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) { System.exit(0); }
});
}

public static void main( String args[] ) throws Exception {
SampleTreeLayout app = new SampleTreeLayout();

Tree tree = app.initTree();
app.showTree( tree );
app.setTitle( "SampleNodeFlow" );
app.setVisible( true );
app.vgraph.layout();
}
}
//end of code.

My problems are:

1. How to make the graph output to be displayed automatically in horizontal format?. Currently, the graph output is displayed in vertical format.
2. How to make the node to be displayed in circle shape? Currently, the node is displayed in rectangle shape.
3. How can I program so that node number 1 is in red color and node number 4 is in green color?
4. How to make each node available to be right click and an option given to the user to select ?add new node?? Once the user select ?add new node? the new node will appear. Following the above example, if user right click at node 2 and select ?add new node?, the new node (node 5) should appear. How can I do that?

I hope that I am not burdening all of you with these questions. I really appreciate if anyone of you can help me on this. I am a newbie in Java language.

Thank you.

Ulamraja.
View Answers









Related Tutorials/Questions & Answers:
Open Jgraph Problem - Java Beginners
Open Jgraph Problem  Hi, I have go through the example given in http://sourceforge.net/projects/openjgraph/ for Open Jgraph by Jesus M. Salvo Jr. I have amended one of the sample (SampleTreeLayout.java) codes as below
jgraph
jGraph       Jgraph is open source software for drawing graphs and structured drawings. Jgraph is written in Java Programming language. Jgraph was started by Gaudenz Alder
Advertisements
Problem with open connection - Hibernate
Problem with open connection  Hi Team, I am running one hibernate application and the database is ORACLE 10g.I am getting the below error.I... open connection
Version of jgraph>jgraph dependency
List of Version of jgraph>jgraph dependency
Artifacts of jgraph
List of Artifacts of jgraph maven depenency
Maven Repository/Dependency: jgraph | jgraph
Maven Repository/Dependency of Group ID jgraph and Artifact ID jgraph. Latest version of jgraph:jgraph dependencies. # Version Release Date 1 5.0.3 10 Aug 2016
ModuleNotFoundError: No module named 'jgraph'
ModuleNotFoundError: No module named 'jgraph'  Hi, My Python... 'jgraph' How to remove the ModuleNotFoundError: No module named 'jgraph'... to install padas library. You can install jgraph python with following command
Version of jgraph>jgraphaddons dependency
Maven dependency for jgraph - jgraph version 5.0.3 is released. Learn to use jgraph version 5.0.3 in Maven based Java projects
Maven dependency for  jgraph  - Version 5.0.3 of jgraph released The developers of   jgraph - jgraph project have released the latest version of this library on 10 Aug 2016, the released version of  jgraph
Maven dependency for jgraph - jgraph version 5.5.1 is released. Learn to use jgraph version 5.5.1 in Maven based Java projects
Maven dependency for  jgraph  - Version 5.5.1 of jgraph released The developers of   jgraph - jgraph project have released the latest version of this library on 01 Aug 2005, the released version of  jgraph
Maven Dependency jgraph >> 1.0.6
You should include the dependency code given in this page to add Maven Dependency of jgraph >> jgraph version1.0.6 in your project
Maven Dependency jgraph >> 1.0.7
You should include the dependency code given in this page to add Maven Dependency of jgraph >> jgraph version1.0.7 in your project
Maven Dependency jgraph >> 2.0
You should include the dependency code given in this page to add Maven Dependency of jgraph >> jgraph version2.0 in your project
Maven Dependency jgraph >> 2.1.1
You should include the dependency code given in this page to add Maven Dependency of jgraph >> jgraph version2.1.1 in your project
Maven Dependency jgraph >> 2.2.1
You should include the dependency code given in this page to add Maven Dependency of jgraph >> jgraph version2.2.1 in your project
Maven Dependency jgraph >> 3.1
You should include the dependency code given in this page to add Maven Dependency of jgraph >> jgraph version3.1 in your project
Maven Dependency jgraph >> 5.0.3
You should include the dependency code given in this page to add Maven Dependency of jgraph >> jgraph version5.0.3 in your project
Maven Dependency jgraph >> 5.0.4
You should include the dependency code given in this page to add Maven Dependency of jgraph >> jgraph version5.0.4 in your project
Maven Dependency jgraph >> 5.13.0.0
You should include the dependency code given in this page to add Maven Dependency of jgraph >> jgraph version5.13.0.0 in your project
Maven Dependency jgraph >> 5.5.1
You should include the dependency code given in this page to add Maven Dependency of jgraph >> jgraph version5.5.1 in your project
Maven Dependency jgraph >> 5.8.3.1
You should include the dependency code given in this page to add Maven Dependency of jgraph >> jgraph version5.8.3.1 in your project
Maven Repository/Dependency: jgraph | jgraphaddons
Maven Repository/Dependency of Group ID jgraph and Artifact ID jgraphaddons. Latest version of jgraph:jgraphaddons dependencies. # Version Release Date You can read more at: Maven
How do I use JGraph to create a MST(minimum spanning tree) using java?
How do I use JGraph to create a MST(minimum spanning tree) using java?  How do I use JGraph to create a MST(minimum spanning tree) using java? thanks for the help
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot... havenot set the build path.if this is the problem then tell me how to set
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot... havenot set the build path.if this is the problem then tell me how to set
problem in onlinetest...
problem in onlinetest...  hi, my code getting the problem is ,when user leave a question then the server puts error... pls help me
problem in coding
problem in coding  i have a following code which display the contents of the text file but not other program like java or any c program is there any handler to open the program files other than Filereader. FileReader fr = new
problem in validation
problem in validation  sir/madam, i m using struts-1.3.10. i m getting a problem my properties file is not found.... while i hav configuired it in struts-config.xml file, likeADS_TO_REPLACE_1 thanks n regards himanshu
javascript problem
javascript problem  hi guys My problem is that I am using radio button for yes or no but i want to do that if I press yes button then enter... enter please help me this problem
problem on strings
problem on strings  in string1 "123456 ABC DEF...",IN string2 "raveen". iwant to add string2 after 123456 in the first string based on index number.i need logic for this with out using StringBuffer concept. Thanks in advanace
Problem with loginbean.jsp
Problem with loginbean.jsp  http://www.roseindia.net/jsp/loginbean.shtml - I am getting an error in loginbean.jsp.There is some error regarding .What is hello in this? Also in this example how
Problem with cookies
Problem with cookies  Hello All, i need jsp code for RememberMe module of login. i am facing problem with cookies. so please if any one could guide me please help and provide mme the exact code.   Please visit
problem with package
problem with package  Dear sir, i have created one java file with package com.net; and i compiled the program.it showing the .class file in " net" folder.The problem is i want to use that .class file in some other
Open or Open Source Software
Open or Open Source Software  what is mean by open or open source software in Computer Terminology?   In a computer terminology, open or open source software means any technology or a software that are freely available
Oracle9i Problem
Oracle9i Problem  Hi I have a problem in Oracle9i .I have... the table what i created .But after closing the SQL+ ,the problem started.When i... .....;.it is saying no rows are selected.Why the problem arised in not getting the data that i
problem with session.invalidate()
problem with session.invalidate()  i stuck by a line with "session.invalidate()", after user logout also by pressing the back button of the browser user is still able to navigate to his home page and able to view the session
JScrollBar Problem...
JScrollBar Problem...  Hello Sir/mam, Can i know how to use JScrollBar to JFrame without adding any JPanel to it.. i want to add JScrollBar Directly to JFrame... Please Provide me Simple Example so i can understand
problem on php
problem on php   l have five tables and build them as forms and link between them php and database and i want to build query between them plz help me soon   PHP MySQL Tutorials
URL problem
URL problem  Hi. I have created a webpage for my project website. in that i have used frameset to split the page. Now if i click any link in the page its navigating to the another page. but the problem is here in the url its
Is AI a problem?
Is AI a problem?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: Is AI a problem? Try... "Is AI a problem?". Also tell me which is the good training courses
Skyline Problem
is the line tracing the largest y value from any rectangle in S The Problem: Write.... Your method should solve the problem three different ways; each solution
Problem in Array
Problem in Array  Hi, Can you help me with this problem? Run a program that check if the input string contains equal number of A's and B's. Hoping for your answer.Thank you.   Here is an example that check
problem
Problem
Problem
problem
problem
PROBLEM IDENTIFICATION
PROBLEM IDENTIFICATION  class MOrders { int nooforders; // Data members of the class public int getorder() { nooforders = 500; } public void displayorders() { System.out.println("The number of orders to be delivered
problem in html
problem in html  i want that my custmer can upload file or video on my website so plz help and send me the code which i can paste on my web site so people can upload their video and img and plz send the html code becaz my web
HttpSession problem :(
HttpSession problem :(  i want to ask that do i need to define httpsession in every servlet or jsp in my web application? if yes, then on which servlet? the very first one like my welcome page which comes after login page

Ads