Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Screenshot Dialog

Return to the EJS Modeling forum
Login to post to this thread

Screenshot Dialog - May 21, 2013 at 10:19AM
Julia Branke
11 Posts

In an ejs Simulation you can take a screenshot with right mouse click, screenshot (third from above in menue, not sure about what is really says in English) and then image.

My problem is (on OS X) that the dialog does not fit into the window that shows and it looks weird, unless you resize the dialog, but this is sort of not really obvious, that something is hidden.

I think the image that will be saved is just not scaled right into the dialog.

I wanted to offer a button in my simulation to save a screenshot and would be happy to have a dialog without any image in it.

In Eclipse I achieved this by making a function like the function saveImage out of SnapshotTool and commented out some lines (see end of post).

But if I package the simulation out of eclipse I get way bigger file sizes than out of ejs, and I have not figured out how to change this (any hints on this would also be appreciated) and so I would like to have the dialog without picture or with correctly displayed picture in ejs. A _view.saveImage function would be great.

I gave up the put my saveImage Function into ejs, because of all the imports I would need to do so. But maybe I will try again using the imports functionality in run options.

But I still would like the screenshot dialog to look neat.

Any help would be greatly appreciated.


    if((output==null)&&(filename==null)) {                                 // Select target file and scale
      JLabel label = new JLabel();
      label.setIcon(new ImageIcon(bi));
      /* This code is temporarily disabled because it doesn't work properly for all types of components
      */
//      JLabel labelScale = new JLabel(res.getString("SnapshotTool.Scale")); //$NON-NLS-1$
//      labelScale.setBorder(new javax.swing.border.EmptyBorder(0, 5, 0, 5));
      JTextField scaleField = new JTextField(Double.toString(scale));
//      JPanel scalePanel = new JPanel(new BorderLayout());
//      scalePanel.add(labelScale, BorderLayout.WEST);
//      scalePanel.add(scaleField, BorderLayout.CENTER);
//      JPanel panel = new JPanel(new BorderLayout());
//      panel.add(label, BorderLayout.CENTER);
//      panel.add(scalePanel, BorderLayout.SOUTH);
//chooser.setAccessory(panel);

Attached File: dialog.png


Current Replies - View all
Re: Screenshot Dialog   (Francisco Esquembre - May 22, 2013 at 3:33PM)
Re: Re: Screenshot Dialog   (Julia Branke - May 22, 2013 at 4:07PM)
The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics