From 91cbf7dcb12bcf1a4da1e2b93d49330ea112933d Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Mon, 10 Mar 2008 03:22:25 +0100 Subject: [PATCH] Add very simple and ugly Help->About menu and dialog --- src/remote/gui/ReMote.java | 81 ++++++++++++++++------------------------------ 1 file changed, 28 insertions(+), 53 deletions(-) diff --git a/src/remote/gui/ReMote.java b/src/remote/gui/ReMote.java index 7c977e3..f8103e1 100644 --- a/src/remote/gui/ReMote.java +++ b/src/remote/gui/ReMote.java @@ -89,6 +89,14 @@ import remote.gui.util.TableRowOrdering; public class ReMote extends JFrame implements SessionEventListener,AuthenticationListener { +private String aboutText + = "Re-Mote client version 1.0\n\n" + + " - Written by Esben Zeuthen, Jonas Fonseca and Rosta Spinar\n\n" + + "This software uses InfoNode Docking Windows " + + "http://www.infonode.net)\n\n" + + "This software is free of charge and is available from " + + "http://remote-testbed.googlecode.com/"; + private static int VIEW_ALL_MOTES = 0; private static int VIEW_CONTROLLED_MOTES = 1; @@ -101,11 +109,6 @@ public class ReMote extends JFrame implements SessionEventListener,Authenticatio private JMenuBar jJMenuBar = null; - private JMenu helpMenu = null; - - - private JMenuItem aboutMenuItem = null; - private RootWindow rootWindow = null; private RootWindowProperties rootWindowProperties = null; @@ -160,10 +163,6 @@ public class ReMote extends JFrame implements SessionEventListener,Authenticatio } }; - - - private JMenuItem quickHelpMenuItem; - protected HashMap moteViews = new HashMap(); private static class MoteView extends View { @@ -384,60 +383,36 @@ public class ReMote extends JFrame implements SessionEventListener,Authenticatio }); //submenu.add(menuitem); jJMenuBar.add(submenu); - } - return jJMenuBar; - } - - /** - * This method initializes jMenu - * - * @return javax.swing.JMenu - */ - private JMenu getHelpMenu() { - if (helpMenu == null) { - helpMenu = new JMenu(); - helpMenu.setText("Help"); - helpMenu.add(getQuickHelpMenuItem()); - helpMenu.add(getAboutMenuItem()); - } - return helpMenu; - } + // HELP MENU + submenu = new JMenu("Help"); - private JMenuItem getAboutMenuItem() { - if (aboutMenuItem == null) { - aboutMenuItem = new JMenuItem(); - aboutMenuItem.setText("About Re-Mote..."); - aboutMenuItem.addActionListener(new ActionListener() { + menuitem = new JMenuItem(); + menuitem.setText("About Re-Mote..."); + menuitem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - JTextArea aboutText = new JTextArea("Re-Mote version 0.9 by Esben Zeuthen\n\n" + - "This software uses InfoNode Docking Windows (http://www.infonode.net)\n\n" + - "This software is free of charge and is available from http://www.sf.net/projects/re-mote"); - aboutText.setEditable(false); - aboutText.setLineWrap(true); - aboutText.setWrapStyleWord(true); + JTextPane about = new JTextPane(); + about.setText(aboutText); + about.setEditable(false); JDialog aboutDialog = new JDialog(ReMote.this,"About Re-Mote",true); - aboutDialog.add(aboutText,BorderLayout.CENTER); - aboutDialog.setSize(200,200); + aboutDialog.add(about, BorderLayout.CENTER); + Dimension prefSize = about.getPreferredSize(); + if (prefSize.width > 400) + prefSize.width = 400; + if (prefSize.height > 400) + prefSize.height = 400; + + aboutDialog.setSize(prefSize); aboutDialog.setVisible(true); } }); - } - return aboutMenuItem; - } - - private JMenuItem getQuickHelpMenuItem() { - if (quickHelpMenuItem == null) { - quickHelpMenuItem = new JMenuItem(); - //quickHelpMenuItem.setText("Quick help..."); - quickHelpMenuItem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + submenu.add(menuitem); + jJMenuBar.add(submenu); - } - }); } - return quickHelpMenuItem; + return jJMenuBar; } + private View getAllMotesView() { try { View allMotesView = views[VIEW_ALL_MOTES]; -- 2.11.4.GIT