return new Dimension(width, height);
}
private static EcAutoUpdate checkForUpdates()
{
EcAutoUpdate ecUpdater = new EcAutoUpdate(EvolutionChamber.VERSION, new EcAutoUpdate.Callback(){
@Override
public void checksumFailed()
{
JOptionPane.showMessageDialog(null, messages.getString("update.checksumFailed.message"), messages.getString("update.checksumFailed.title"), JOptionPane.ERROR_MESSAGE);
}
@Override
public void updateCheckFailed()
{
JOptionPane.showMessageDialog(null, messages.getString("update.updateCheckFailed.message"), messages.getString("update.updateCheckFailed.title"), JOptionPane.WARNING_MESSAGE);
}
});
if (ecUpdater.isUpdateAvailable())
{
JOptionPane pane = new JOptionPane(messages.getString("update.updateAvailable.message"));
String yes = messages.getString("update.updateAvailable.yes");
String no = messages.getString("update.updateAvailable.no");
pane.setOptions(new String[] { yes, no });
JDialog dialog = pane.createDialog(new JFrame(), messages.getString("update.updateAvailable.title", ecUpdater.getLatestVersion()));
dialog.setVisible(true);
Object selection = pane.getValue();
if (selection.equals(yes))
{
JFrame updateFrame = new JFrame();
updateFrame.setTitle(messages.getString("update.updating.title"));
updateFrame.setResizable(false);
ImageIcon icon = new ImageIcon(EcSwingXMain.class.getResource(iconLocation));
updateFrame.setIconImage(icon.getImage());
final JProgressBar updateProgress = new JProgressBar(0, 100);
updateProgress.setValue(0);
updateProgress.setStringPainted(true);
updateFrame.add(updateProgress);
updateFrame.setPreferredSize(new Dimension(200, 100));
updateFrame.pack();
updateFrame.setLocationRelativeTo(null);
updateFrame.setVisible(true);
ecUpdater.addPropertyChangeListener(new PropertyChangeListener()
{
public void propertyChange(PropertyChangeEvent evt)
{
if ("progress".equals(evt.getPropertyName()))
{
updateProgress.setValue((Integer) evt.getNewValue());
}
}
});
ecUpdater.setUpdating(true);
ecUpdater.execute();
}
}
return ecUpdater;
}