/** * Actions-handling method. * * @param e The event. */ public void actionPerformed(ActionEvent e) { // Prepares the file chooser JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(new File(idata.getInstallPath())); fc.setMultiSelectionEnabled(false); fc.addChoosableFileFilter(fc.getAcceptAllFileFilter()); // fc.setCurrentDirectory(new File(".")); // Shows it try { if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { // We handle the xml data writing File file = fc.getSelectedFile(); FileOutputStream out = new FileOutputStream(file); BufferedOutputStream outBuff = new BufferedOutputStream(out, 5120); parent.writeXMLTree(idata.xmlData, outBuff); outBuff.flush(); outBuff.close(); autoButton.setEnabled(false); } } catch (Exception err) { err.printStackTrace(); JOptionPane.showMessageDialog( this, err.toString(), parent.langpack.getString("installer.error"), JOptionPane.ERROR_MESSAGE); } }
/** Called when the panel becomes active. */ public void panelActivate() { parent.lockNextButton(); parent.lockPrevButton(); if (idata.installSuccess) { // We set the information centerPanel.add( new JLabel( parent.langpack.getString("FinishPanel.success"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add(Box.createVerticalStrut(20)); if (idata.info.getWriteUninstaller()) { // We prepare a message for the uninstaller feature String path = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller"; centerPanel.add( new JLabel( parent.langpack.getString("FinishPanel.uninst.info"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); centerPanel.add(new JLabel(path, parent.icons.getImageIcon("empty"), JLabel.TRAILING)); } // We add the autoButton centerPanel.add(Box.createVerticalStrut(20)); autoButton = ButtonFactory.createButton( parent.langpack.getString("FinishPanel.auto"), parent.icons.getImageIcon("edit"), idata.buttonsHColor); autoButton.setToolTipText(parent.langpack.getString("FinishPanel.auto.tip")); autoButton.addActionListener(this); centerPanel.add(autoButton); } else centerPanel.add( new JLabel( parent.langpack.getString("FinishPanel.fail"), parent.icons.getImageIcon("information"), JLabel.TRAILING)); }