c.weightx = 1;
topRow.add(export, c);
export.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFileChooser chooser = new JFileChooser();
ARComponent arc = ARComposerApp.this.getARComponent();
int rv = chooser.showSaveDialog(arc);
if (rv != JFileChooser.APPROVE_OPTION) {return;}
File file = chooser.getSelectedFile();
@SuppressWarnings("unchecked") //Will fail if the transfer didn't end up with colors
BufferedImage img = AggregateUtils.asImage((Aggregates<Color>) arc.transferAggregates(), arc.getWidth(), arc.getHeight(), Color.white);
Util.writeImage(img, file);
}
});