{
m_menuBar = new JMenuBar();
setJMenuBar(m_menuBar);
// slideshow menu
JStatusMenu menu = new JStatusMenu(Main.getString("menu_slideshow"), m_statusBar);
m_menuBar.add(menu);
m_slideShowStartStop_menuItem = new JStatusMenuItem(Main.getString("menu_slideshow_start"), Main.getString("statusbar_menu_slideshow_start_help"), m_statusBar);
m_slideShowStartStop_menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0));
menu.add(m_slideShowStartStop_menuItem);
m_slideShowStartStop_menuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
doStartStopSlideShow();
}
});
m_slideShowPause_menuItem = new JStatusCheckBoxMenuItem(Main.getString("menu_slideshow_pause"), Main.getString("statusbar_menu_slideshow_pause_help"), m_statusBar);
m_slideShowPause_menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0));
menu.add(m_slideShowPause_menuItem);
m_slideShowPause_menuItem.setEnabled(false);
m_slideShowPause_menuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
doSlideShowPause();
}
});
// Direction sub menu
JMenu menuSlideShowDirection = new JMenu(Main.getString("menu_slideshow_direction"));
menu.add(menuSlideShowDirection);
for (int i=0; i<m_slideShowDirection_menuItem.length; i++)
{
m_slideShowDirection_menuItem[i] = new JStatusRadioButtonMenuItem(Main.getString(String.format("menu_slideshow_direction_%1$d", i)), Main.getString(String.format("statusbar_menu_slideshow_direction_%1$d_help", i)), m_statusBar);
menuSlideShowDirection.add(m_slideShowDirection_menuItem[i]);
final int ii=i;
m_slideShowDirection_menuItem[i].addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
doSetSlideShowDirection(ii);
}
});
}
m_slideShowDirection_menuItem[Main.m_settings.getSlideShowDirection()].setSelected(true);
m_slideShowLoop_menuItem = new JStatusCheckBoxMenuItem(Main.getString("menu_slideshow_loop"), Main.getString("statusbar_menu_slideshow_loop_help"), m_statusBar);
m_slideShowLoop_menuItem.setState(Main.m_settings.getSlideShowLoop());
menu.add(m_slideShowLoop_menuItem);
m_slideShowLoop_menuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
Main.m_settings.setSlideShowLoop(!Main.m_settings.getSlideShowLoop());
m_slideShowLoop_menuItem.setState(Main.m_settings.getSlideShowLoop());
}
});
// extra menu
menu = new JStatusMenu(Main.getString("menu_extra"), m_statusBar);
m_menuBar.add(menu);
JStatusMenuItem menuItem = new JStatusMenuItem(Main.getString("menu_extra_settings"), Main.getString("statusbar_menu_extra_settings_help"), m_statusBar);
menu.add(menuItem);
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
JSettingsDialog dia = new JSettingsDialog(Main.m_mainFrame);
if (dia.doModal())
{
doSaveSettings();
doInitTimers();
}
}
});
// Look and Feel
final JMenu lfMenu = new JMenu(Main.getString("menu_lookandfeel"));
LookAndFeelInfo[] lfArray = UIManager.getInstalledLookAndFeels();
JStatusRadioButtonMenuItem radioButtonMenuItem;
int count = 0;
for (LookAndFeelInfo lfInfo : lfArray)
{
radioButtonMenuItem = new JStatusRadioButtonMenuItem(lfInfo.getName(), String.format(Main.getString("statusbar_menu_extra_lf_help"), lfInfo.getName()), m_statusBar);
radioButtonMenuItem.setActionCommand(lfInfo.getClassName());
radioButtonMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
try
{
Main.m_settings.setLookAndFeel(ev.getActionCommand());
int i, anzahl = lfMenu.getItemCount();
for (i=0; i< anzahl; i++)
{
JRadioButtonMenuItem menuItem = (JRadioButtonMenuItem)lfMenu.getItem(i);
menuItem.setSelected(menuItem.getActionCommand().equals(ev.getActionCommand()));
}
}
catch(Exception ex)
{
}
// Restart
if (JOptionPane.showConfirmDialog(Main.m_mainFrame, Main.getString("lookandfeel_restart_ask"), Main.getMessageBoxCaption(), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION)
{
try
{
String path = JClassPathHelper.getClassPath(this, true);
if (path != null)
{
doSaveSettings();
setVisible(false);
path = JPathHelper.addSeparator(path);
path += "jstart.jar";
String[] cmdArray = {JInfoHelper.getJavaExecutablePath(), "-jar", path};
if (Main.m_settings.isDebug())
{
System.err.println(cmdArray[0]);
System.err.println(path);
}
Runtime.getRuntime().exec(cmdArray);
System.exit(0);
}
}
catch(Exception ex)
{
setVisible(true);
System.err.println(ex);
}
}
}
});
radioButtonMenuItem.setSelected(Main.m_settings.getLookAndFeel().equals(lfInfo.getClassName()));
lfMenu.add(radioButtonMenuItem);
}
menu.add(lfMenu);
// help menu
menu = new JStatusMenu(Main.getString("menu_help"), m_statusBar);
m_menuBar.add(menu);
menuItem = new JStatusMenuItem(Main.getString("menu_help_help"), Main.getString("statusbar_menu_help_help_help"), m_statusBar);
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));
menu.add(menuItem);
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
JBrowser browser = new JBrowser(Main.m_mainFrame, Main.getString("help_caption"), getClass().getResource(Main.getString("helpfile")));
browser.setVisible(true);
}
});
menuItem = new JStatusMenuItem(Main.getString("menu_help_web"), Main.getString("statusbar_menu_help_web_help"), m_statusBar);
menu.add(menuItem);
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
if (!JBrowserLaunch.openURL(m_homepage))
{
JOptionPane.showMessageDialog(Main.m_mainFrame, String.format(Main.getString("msg_browserlaunch_failed"), m_homepage), Main.getMessageBoxCaption(), JOptionPane.PLAIN_MESSAGE, Main.m_icon32);
}
}
});
menu.addSeparator();
menuItem = new JStatusMenuItem(Main.getString("menu_help_update"), Main.getString("statusbar_menu_help_update_help"), m_statusBar);
menu.add(menuItem);
menuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
{
doCheckForUpdates(true);
}
});
menu.addSeparator();
menuItem = new JStatusMenuItem(Main.getString("menu_help_about"), Main.getString("statusbar_menu_help_about_help"), m_statusBar);
menu.add(menuItem);
menuItem.addActionListener(new ActionListener()
{
@Override
public void actionPerformed(ActionEvent ev)
{