Build Graph From File : Graph Editor « Advanced Graphics « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Collections Data Structure
8. Database SQL JDBC
9. Design Pattern
10. Development Class
11. Email
12. Event
13. File Input Output
14. Game
15. Hibernate
16. J2EE
17. J2ME
18. JDK 6
19. JSP
20. JSTL
21. Language Basics
22. Network Protocol
23. PDF RTF
24. Regular Expressions
25. Security
26. Servlets
27. Spring
28. Swing Components
29. Swing JFC
30. SWT JFace Eclipse
31. Threads
32. Tiny Application
33. Velocity
34. Web Services SOA
35. XML
Microsoft Office Word 2007 Tutorial
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Java » Advanced Graphics » Graph EditorScreenshots 
Build Graph From File

import java.awt.*;
import java.applet.*;
import java.net.URL;
import java.util.*;
import java.io.InputStream;
import graph.*;
/*************************************************************************
**
**    Applet graph
**                                              Version 1.0   January 1996
**
**************************************************************************
**    Copyright (C) 1996 Leigh Brookshaw
**
**    This program is free software; you can redistribute it and/or modify
**    it under the terms of the GNU General Public License as published by
**    the Free Software Foundation; either version 2 of the License, or
**    (at your option) any later version.
**
**    This program is distributed in the hope that it will be useful,
**    but WITHOUT ANY WARRANTY; without even the implied warranty of
**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
**    GNU General Public License for more details.
**
**    You should have received a copy of the GNU General Public License
**    along with this program; if not, write to the Free Software
**    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**************************************************************************
**
**    This applet uses the BuildGraph class to construct a plot from
**    description file. This applet is general enough to be used for
**    many sorts of plots.
**
*************************************************************************/

public class graph extends Applet {

      BuildGraph build;
      InputStream in;
      URL url;
      Graph2D graph;
      TextLine title;
      Label label = new Label();

      public void init() {

        setLayoutnew BorderLayout() );

        String data  = "example5.data";
        try {
              url = this.getClass().getResource(data);
      }
        catch(Exception e) {
              System.out.println("Failed to construct URL from data name");
             // showStatus("Applet: Failed to construct URL from data name");
              return;
      }

        try {
              in = url.openStream();
      }
        catch(Exception e) {
              System.out.println("Failed to open Data Stream");
              //showStatus("Applet: Failed to open Data Stream");
              return;
      }
        
        build = new BuildGraph(in,this);

//        showStatus("Applet: Started building graph!");

        build.parse();

        graph = (Graph2D)(build.getGraph());

        if(graph != nulladd("Center",graph);

        title = build.getGraphTitle();

        if(title != null && !title.isNull()) {
              label.setText(title.getText());
              label.setAlignment(Label.CENTER);
              iftitle.getFont() != null ) {
                 label.setFont(title.getFont());
         }
              iftitle.getColor() != null ) {
                 label.setForeground(title.getColor());
         }

              add("North",label);
  }


      }
      public static void main(String[] a){
         javax.swing.JFrame f = new javax.swing.JFrame();
         Applet app = new graph();
         app.init();
         
         f.getContentPane().add (app);

         f.pack();
         f.setSize (new Dimension (500500));
         f.setVisible(true);
      }

}





           
       
Graph-BuildGraphFromFile.zip( 294 k)
Related examples in the same category
1. Graph Editor DemoGraph Editor Demo
2. Graph Editor Demo 2Graph Editor Demo 2
3. Graph Editor Demo 3Graph Editor Demo 3
4. Graph Editor Demo 4Graph Editor Demo 4
5. Port ViewPort View
w_w_w.___ja___v__a___2_s___._c_o___m_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.