Zoom Demo : Zoom « 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 » ZoomScreenshots 
Zoom Demo
Zoom Demo

import java.awt.*;

import javax.swing.*;

import no.geosoft.cc.geometry.Geometry;
import no.geosoft.cc.graphics.*;



/**
 * G demo program. Demonstrates:
 *
 * <ul>
 *   <li> The effect of using world coordinates
 *   <li> Default zoom interaction
 * </ul>
 
 @author <a href="mailto:jacob.dreyer@geosoft.no">Jacob Dreyer</a>
 */   
public class Demo1a extends JFrame
{
  public Demo1a()
  {
    super ("G Graphics Library - Demo 1a");    
    setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
    
    // Create the graphic canvas
    GWindow window = new GWindow(new Color (210235255));
    getContentPane().add (window.getCanvas());
    
    // Create scene with default viewport and world extent settings
    GScene scene = new GScene (window);
    scene.setWorldExtent (0.00.01.01.0);

    // Create the graphics object and add to the scene
    GObject object = new HelloWorld();
    scene.add (object);

    pack();
    setSize (new Dimension (500500));
    setVisible (true);

    window.startInteraction (new ZoomInteraction (scene));
  }


  
  /**
   * Defines the geometry and presentation for the sample
   * graphic object.
   */   
  public class HelloWorld extends GObject
  {
    private GSegment star_;
    
    
    public HelloWorld()
    {
      star_ = new GSegment();
      GStyle starStyle = new GStyle();
      starStyle.setForegroundColor (new Color (25500));
      starStyle.setBackgroundColor (new Color (2552550));
      starStyle.setLineWidth (3);
      setStyle (starStyle);
      addSegment (star_);
      
      GText text = new GText ("HelloWorld", GPosition.MIDDLE);
      GStyle textStyle = new GStyle();
      textStyle.setForegroundColor (new Color (100100150));
      textStyle.setBackgroundColor (null);
      textStyle.setFont (new Font ("Dialog", Font.BOLD, 48));
      text.setStyle (textStyle);
      star_.setText (text);
    }
    

  
    /**
     * This method is called whenever the canvas needs to redraw this
     * object. For efficiency, prepare as much of the graphic object
     * up front (such as sub object, segment and style setup) and
     * set geometry only in this method.
     */
    public void draw()
    {
      star_.setGeometryXy (Geometry.createStar (0.50.50.40.215));
    }
  }
  


  public static void main (String[] args)
  {
    new Demo1a();
  }
}

           
       
G-DrawStarWithMouseAction.zip( 193 k)
Related examples in the same category
w___w___w__.__j___a_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.