Commits

Anonymous committed 6c30630

added an About Dialog

Comments (0)

Files changed (1)

tailog/src/magmax/tailog/gui/MainWindow.java

 package magmax.tailog.gui;
 
 import java.awt.BorderLayout;
+import java.awt.Dialog;
 import java.awt.Dimension;
 import java.awt.event.ActionEvent;
 import java.io.File;
 import javax.swing.JMenu;
 import javax.swing.JMenuBar;
 import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
 import javax.swing.JScrollPane;
 import javax.swing.JSeparator;
 import javax.swing.JSplitPane;
 			super();
 			add(getMenuFile());
 			add(getMenuEvents());
+			add(getMenuHelp());
 		}
 
+		private JMenu getMenuHelp() {
+			JMenu result = new JMenu("Help");
+
+			JMenuItem about = new JMenuItem("About");
+			about.setAction(new SetAboutAction());
+			result.add(about);
+			
+			return result;
+		}
+		
+		private class SetAboutAction extends AbstractAction {
+			private static final long serialVersionUID = 1L;
+
+			public SetAboutAction() {
+				super("About");
+			}
+
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				AboutWindow f = new AboutWindow(new JFrame());
+			    f.setVisible(true);
+			    f.dispose();
+			}
+		}
+		
 		private JMenu getMenuEvents() {
 			JMenu result = new JMenu("Events");
 
 				JFileChooser chooser = new JFileChooser();
 				if (chooser.showOpenDialog(mainFrame) == JFileChooser.APPROVE_OPTION) {
 					File file = chooser.getSelectedFile();
-					if (modelFiles.contains(file))
-						// FIXME: Show a message.
+					if (modelFiles.contains(file)) {
+						JOptionPane.showMessageDialog(mainFrame,
+							    "That file was already loaded!", 
+							    "Message", 
+							    JOptionPane.INFORMATION_MESSAGE);
 						return;
+					}
 
 					try {
 						modelFiles.addFile(file);