Logo Search packages:      
Sourcecode: javamorph version File versions  Download package

void javamorph::CPolygonDecorator::run (  )  [inline]

Save-on-shutdown-thread.

Definition at line 205 of file CPolygonDecorator.java.

References f_poly, parent, and polygon.

                     {
        try{
            /* Do not save empty polygon => avoid empty arry. */
            if(0 < polygon.size()){
                FileOutputStream out = new FileOutputStream(f_poly);
                out.write('\n');
                /* Write one line for each point of the polygon. */
                for(Point p: polygon){
                    out.write(("" + p.x + ' ').getBytes());
                    out.write(("" + p.y + '\n').getBytes());
                }
                out.close();
            }else{
                f_poly.delete();
            }
        }catch(Exception e){
            System.err.println(e.getMessage());
            e.printStackTrace();
            /* Show error pop up. */
            JOptionPane.showMessageDialog
                (parent, "Can't save polygon. See also console output!");
        }
    }


Generated by  Doxygen 1.6.0   Back to index