An excellent platform independent vector drawing gift for you!
Home | Products | Download | Documentations | Order Now | Contact |  
 
FAQs
Quick Install
Developer Guide
ScreenShots
Award
 
    Java.net
    AbleStable
    Softpedia
    FreeTrialSoft
    FreshMeat
    Download32
    More...
  Developer Guide(Build your application) - JFImagine.com

[Prior]   [Top]   [Next]

3. Build your own vector graph application


         DrawPane UI overview.

    A DrawPane object encapsulates a ScrollPane for scrolling the drawing canvas. And a horizontal ruler on the ColumnHeadView of this ScrollPane, when a vertical ruler on the RowHeadView of it. A DrawCanvas object is placed in the center of the ScrollPane, for showing and drawing shapes, texts and images.

 

   A simple demo based on DrawPane.

    Programming on DrawPane is quite easy, just use codes below to build your first vector graph now!

//Action: create a draw panel
//Desc: A DrawPane object packaged a vertical ruler, a horizontal ruler and a drawing canvas

DrawPane panel =new DrawPane();

//Action: get the draw canvas which is inside of a DrawPane object.
//Desc: A DrawCanvas object is used to draw all of the shapes

DrawCanvas canvas =panel.getDrawCanvas();

//Action: get the page object which is insde of a DrawCanvas object.
//Desc: A JFPage object is used to store all of the shapes

JFPage page =canvas.getDrawPage();

//Action: load a binary jfd file
//Desc:
//The first parameter is a file name string;
//The second parameter is a component where the page will draw on it.
// here it is the draw canvas.

page.loadFromBinary("../data/datagram.jfd",canvas);

//action: add menu to frame
frame.setJMenuBar(Sample1.createMenuBar(panel));

   Screenshot of this sample.

    Now you can take a look at your first experience with JFDraw library! Quite easy? Absolutely!

   

 

  To get full source code of this sample.

    You can download the full sample source code package here. Then open the file at sample1/Sample1.java for detail informations.

[Prior]   [Top]   [Next]