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);
/** * Saves the image produced by a component to disk. * @param _filename the name of a file (either in disk or in memory). Null if the user must select a name. * @param _element the name of the view element to get the image from * @return true if the file was correctly saved */ public boolean saveImage (String _filename, String _element);
You can invoke it as both _view.saveImage of _saveImage. The syntax is: _saveImage ("MyFilename.jpg","plottingFrame");
The "plottingFrame" String refers to an element in your view with that name.