Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Open Jgraph Problem
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Ismet
Open Jgraph Problem
0 Answer(s)      4 years and 10 months ago
Posted in : Java Beginners


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.

Advertisement
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
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
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
open document
open document  open a word document using jsp   Please go through the following link: Java Read word document file The above link will provide an example that will read the document file using POI library in java
why the php is open source?
why the php is open source?  why the php is open source
open pdf in uiwebview
open pdf in uiwebview  Hi, How to open pdf in uiwebview? Thanks
open ERP - WebSevices
open ERP  explain ecommerce module in open ERP5.0
Open Offece
Open Offece.org       OpenOffice.org 2 is the leading open-source office software suite for word... in an international open standard format and can also read and write files from other
open source help desk
Open Source Help Desk Open Source Help Desk Software As my help desk... of the major open source help desk software offerings. I?m not doing... or two. What I?m really looking to do is build relationships with the best open
how to open java
how to open Java  how to open java file simple Java Example
uiwebview open url in safari
uiwebview open url in safari  How to open outgoing URL like ffacebook or twitter in iPhone/iPad
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
unable to open the service tomcat5
unable to open the service tomcat5  While trying to run tomcat server getting "unable to open the service tomcat5" error after installed tomcat
open source project
open source project  i am a b.tec 3rd year ,i want to work in some open source java project, please suggest me
Open-source software
Open-source software  Hi, What is Open-source software? Tell me the most popular open source software name? Thanks   Hi, Open-source software is also know as OSS. Open-source software are those software that comes
links open new windows
links open new windows  Why do my links open new windows rather than update an existing frame
Open Source Accounting
Open Source Accounting Turbocase open source Accounting software TurboCASH .7 is an open source accounting package that is free for everyone... of the world's first fully-featured open source accounts packages for small
Open Source HTML
Open Source HTML HTML Tidy Library Project A quorum... number and column so that you can see where the problem lies in your markup. Tidy...;   Open Source HTML Parsers in Java NekoHTML is a simple HTML
open source - Java Beginners
open source  hi! what is open source? i heard that SUN has released open source .what is re requisite to understand that open source. i know core concepts only  Hi friend, Open source is an approach to design
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
Open Source Jobs
Open Source Jobs Open Source Professionals Search firm specializing in the placement of Linux / Open Source professionals, providing both... / Open Source landscape and employment marketplace make us your most efficient
open word document
open word document  how to open a word document ??   Please go through the following link: Java Read word document file The above link will provide an example that will read the document file using POI library in java
open word document
open word document  how to open a word document ??   Please go through the following link: Java Read word document file The above link will provide an example that will read the document file using POI library in java
open word document
open word document  how to open a word document ??   Please go through the following link: Java Read word document file The above link will provide an example that will read the document file using POI library in java
open taps CRM
open taps CRM  hi Plese guide to me how to forecase in Java Ofbiz Opentaps CRM Module Thanks hasim
How to open an Acroform in iText?
How to open an Acroform in iText?  I modified a client's Acroform in Acrobat Pro 9, and now the client says he can't open it in iText. I had never...\iText_5.0.0.jar. All I want to do, initially, is try to open my PDF in iText, and I can't
Open Source Business,What is OSS,Advantage of Open Source in Business
Open Source for Business Earlier it was uncommon to use the open source... and it was awful to learn all the commands of different open source software... the time has been changed and now business enterprises are using open source
Open Source Hardware
Open Source Hardware What is open source hardware Open-ness in hardware terms can have a whole range of meanings. In all the cases listed below, some hardware is open and some
 

 

 

DMCA.com