SPARK-1072 - Add an option to make chat window always stay on top

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@11088 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Michael Will
2009-06-26 14:36:14 +00:00
committed by michael.will
parent f73e3f1a5a
commit 74858c23ba
5 changed files with 43 additions and 20 deletions

View File

@ -28,6 +28,7 @@ import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
@ -79,7 +80,8 @@ public final class MainWindow extends ChatFrame implements ActionListener {
private final JMenu helpMenu = new JMenu();
private JMenuItem preferenceMenuItem;
private JCheckBoxMenuItem alwaysOnTopItem;
private final JMenuItem menuAbout = new JMenuItem(SparkRes.getImageIcon(SparkRes.INFORMATION_IMAGE));
private final JMenuItem helpMenuItem = new JMenuItem();
@ -368,6 +370,33 @@ public final class MainWindow extends ChatFrame implements ActionListener {
preferenceMenuItem.setText(Res.getString("title.spark.preferences"));
preferenceMenuItem.addActionListener(this);
connectMenu.add(preferenceMenuItem);
alwaysOnTopItem = new JCheckBoxMenuItem();
ResourceUtils.resButton(alwaysOnTopItem, Res.getString("menuitem.always.on.top"));
alwaysOnTopItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
if (alwaysOnTopItem.isSelected())
{
SettingsManager.getLocalPreferences().setAlwaysOnTop(true);
MainWindow.getInstance().setAlwaysOnTop(true);
}
else
{
SettingsManager.getLocalPreferences().setAlwaysOnTop(false);
MainWindow.getInstance().setAlwaysOnTop(false);
}
}
});
if (SettingsManager.getLocalPreferences().isAlwaysOnTop())
{
alwaysOnTopItem.setSelected(true);
this.setAlwaysOnTop(true);
}
connectMenu.add(alwaysOnTopItem);
connectMenu.addSeparator();
JMenuItem logoutMenuItem = new JMenuItem();
@ -386,7 +415,6 @@ public final class MainWindow extends ChatFrame implements ActionListener {
}
});
if (Spark.isWindows()) {
connectMenu.add(logoutMenuItem);
connectMenu.add(logoutWithStatus);