| 373 | | if(e.getKeyChar() == 'e') { |
|---|
| 374 | | |
|---|
| 375 | | int option = chooser.showSaveDialog(frame); |
|---|
| 376 | | if(option == JFileChooser.APPROVE_OPTION) { |
|---|
| 377 | | Properties properties = new Properties(); |
|---|
| 378 | | properties.setProperty("PageSize", "A5"); |
|---|
| 379 | | |
|---|
| 380 | | try { |
|---|
| 381 | | |
|---|
| 382 | | |
|---|
| 383 | | |
|---|
| 384 | | |
|---|
| 385 | | //display.saveImage(new FileOutputStream(chooser.getSelectedFile()), "eps", 1.0); |
|---|
| 386 | | |
|---|
| 387 | | |
|---|
| 388 | | //Rectangle2D bounds = visualization.getBounds(all); |
|---|
| 389 | | |
|---|
| 390 | | VectorGraphics graphics = new PSGraphics2D(chooser.getSelectedFile(), display.getSize()); |
|---|
| 391 | | graphics.setProperties(properties); |
|---|
| 392 | | graphics.startExport(); |
|---|
| 393 | | display.printAll(graphics); |
|---|
| 394 | | graphics.endExport(); |
|---|
| 395 | | } catch (FileNotFoundException e1) { |
|---|
| 396 | | // TODO Auto-generated catch block |
|---|
| 397 | | e1.printStackTrace(); |
|---|
| 398 | | } |
|---|
| 399 | | } |
|---|
| 400 | | |
|---|
| 401 | | |
|---|
| 402 | | |
|---|
| 403 | | |
|---|
| 404 | | |
|---|
| 405 | | //ExportDialog export = new ExportDialog(); |
|---|
| 406 | | //export.showExportDialog(frame, "Export visualization as . . .", display, "export"); |
|---|
| | 373 | if(e.getKeyChar() == 'e') { |
|---|
| | 374 | exportGraphToFile(frame, display); |
|---|
| 421 | | int option = chooser.showSaveDialog(frame); |
|---|
| 422 | | if(option == JFileChooser.APPROVE_OPTION) { |
|---|
| 423 | | Properties properties = new Properties(); |
|---|
| 424 | | properties.setProperty("PageSize", "A5"); |
|---|
| 425 | | |
|---|
| 426 | | try { |
|---|
| 427 | | |
|---|
| 428 | | |
|---|
| 429 | | //display.saveImage(new FileOutputStream(chooser.getSelectedFile()), "eps", 1.0); |
|---|
| 430 | | |
|---|
| 431 | | |
|---|
| 432 | | //Rectangle2D bounds = visualization.getBounds(all); |
|---|
| 433 | | |
|---|
| 434 | | VectorGraphics graphics = new PSGraphics2D(chooser.getSelectedFile(), display.getSize()); |
|---|
| 435 | | graphics.setProperties(properties); |
|---|
| 436 | | graphics.startExport(); |
|---|
| 437 | | display.printAll(graphics); |
|---|
| 438 | | graphics.endExport(); |
|---|
| 439 | | } catch (FileNotFoundException e1) { |
|---|
| 440 | | // TODO Auto-generated catch block |
|---|
| 441 | | e1.printStackTrace(); |
|---|
| 442 | | } |
|---|
| 443 | | } |
|---|
| 444 | | |
|---|
| 445 | | } |
|---|
| 446 | | |
|---|
| 447 | | } |
|---|
| 448 | | |
|---|
| | 389 | exportGraphToFile(frame, display); |
|---|
| | 390 | } |
|---|
| | 391 | } |
|---|
| | 414 | |
|---|
| | 415 | private void exportGraphToFile (JFrame frame, Display display){ |
|---|
| | 416 | int option = chooser.showSaveDialog(frame); |
|---|
| | 417 | if(option == JFileChooser.APPROVE_OPTION) { |
|---|
| | 418 | Properties properties = new Properties(); |
|---|
| | 419 | properties.setProperty("PageSize", "A5"); |
|---|
| | 420 | |
|---|
| | 421 | try { |
|---|
| | 422 | //display.saveImage(new FileOutputStream(chooser.getSelectedFile()), "eps", 1.0); |
|---|
| | 423 | //Rectangle2D bounds = visualization.getBounds(all); |
|---|
| | 424 | |
|---|
| | 425 | VectorGraphics graphics = new PSGraphics2D(chooser.getSelectedFile(), display.getSize()); |
|---|
| | 426 | graphics.setProperties(properties); |
|---|
| | 427 | graphics.startExport(); |
|---|
| | 428 | display.printAll(graphics); |
|---|
| | 429 | graphics.endExport(); |
|---|
| | 430 | } catch (FileNotFoundException e1) { |
|---|
| | 431 | // TODO Auto-generated catch block |
|---|
| | 432 | e1.printStackTrace(); |
|---|
| | 433 | } |
|---|
| | 434 | //ExportDialog export = new ExportDialog(); |
|---|
| | 435 | //export.showExportDialog(frame, "Export visualization as . . .", display, "export"); |
|---|
| | 436 | |
|---|
| | 437 | } |
|---|
| | 438 | |
|---|
| | 439 | } |
|---|
| | 440 | |
|---|