mOpenCloseMenuItem.setFont(f.deriveFont(Font.BOLD));
mQuitMenuItem = new JMenuItem(mLocalizer.msg("menu.quit", "Quit"), TVBrowserIcons.quit(TVBrowserIcons.SIZE_SMALL));
mConfigure = new JMenuItem(mLocalizer.msg("menu.configure", "Configure"), TVBrowserIcons
.preferences(TVBrowserIcons.SIZE_SMALL));
mConfigure.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
MainFrame.getInstance().showSettingsDialog(SettingsItem.TRAY);
}
});
mOpenCloseMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
toggleShowHide();
}
});
mReminderItem = new JMenuItem(mLocalizer.msg("menu.pauseReminder", "Pause Reminder"));
mReminderItem.setIcon(IconLoader.getInstance().getIconFromTheme("apps", "appointment", 16));
mReminderItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
toggleReminderState(false);
}
});
mQuitMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
MainFrame.getInstance().quit();
}
});
mSystemTray.addLeftClickAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (mClickTimer == null || !mClickTimer.isAlive()) {
toggleShowHide();
}
}
});
MainFrame.getInstance().addComponentListener(new ComponentListener() {
public void componentResized(ComponentEvent e) {
int state = MainFrame.getInstance().getExtendedState();
if ((state & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH) {
mState = Frame.MAXIMIZED_BOTH;
} else if ((state & Frame.ICONIFIED) != Frame.ICONIFIED) {
mState = Frame.NORMAL;
}
}
public void componentHidden(ComponentEvent e) {
}
public void componentMoved(ComponentEvent e) {
}
public void componentShown(ComponentEvent e) {
}
});
MainFrame.getInstance().addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(WindowEvent e) {
toggleOpenCloseMenuItem(false);
}
public void windowClosing(java.awt.event.WindowEvent evt) {
if (Settings.propOnlyMinimizeWhenWindowClosing.getBoolean()) {
toggleShowHide();
} else {
MainFrame.getInstance().quit();
}
}
public void windowDeiconified(WindowEvent e) {
toggleOpenCloseMenuItem(false);
}
public void windowIconified(java.awt.event.WindowEvent evt) {
if (Settings.propTrayMinimizeTo.getBoolean()) {
MainFrame.getInstance().setVisible(false);
}
toggleOpenCloseMenuItem(true);
}
});
toggleOpenCloseMenuItem(false);
mTrayMenu = new JPopupMenu();
mSystemTray.addRightClickAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// mTrayMenu.getPopupMenu().setVisible(false);
buildMenu();
}