Selaa lähdekoodia

Adds About PopUp

Andreas T. Meyer-Berg 5 vuotta sitten
vanhempi
commit
fb6cf53000

+ 15 - 7
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/MenuBar.java

@@ -8,6 +8,7 @@ import javax.swing.JMenuItem;
 
 import de.tu_darmstadt.tk.SmartHomeNetworkSim.control.Controller;
 import de.tu_darmstadt.tk.SmartHomeNetworkSim.core.Model;
+import de.tu_darmstadt.tk.SmartHomeNetworkSim.view.popups.AboutPopUp;
 import de.tu_darmstadt.tk.SmartHomeNetworkSim.view.popups.SimulationConfigurator;
 
 /**
@@ -29,7 +30,7 @@ public class MenuBar extends JMenuBar {
 	/**
 	 * JMenu for the Simulation
 	 */
-	JMenu mntmSimulation;
+	JMenu mnSimulation;
 	
 	/**
 	 * JMenu for Editing of Devices, Options etc. 
@@ -39,7 +40,7 @@ public class MenuBar extends JMenuBar {
 	/**
 	 * JMenu for help with the program
 	 */
-	JMenu mntmHelp;
+	JMenu mnHelp;
 	
 	/**
 	 * Serial Version
@@ -58,25 +59,25 @@ public class MenuBar extends JMenuBar {
 		this.setLayout(new FlowLayout(FlowLayout.LEADING));
 
 		initializeSimulationMenu();
-		this.add(mntmSimulation);
+		this.add(mnSimulation);
 		initializeEditMenu();
 		this.add(mnEdit);
 		initializeHelpMenu();
-		this.add(mntmHelp);
+		this.add(mnHelp);
 	}
 	
 	/**
 	 * Initializes the Simulation Menu
 	 */
 	private void initializeSimulationMenu(){
-		mntmSimulation = new JMenu("Simulation");
+		mnSimulation = new JMenu("Simulation");
 		JMenuItem mntmConfigureSim = new JMenuItem("Configure Sim");
 		mntmConfigureSim.addActionListener(a->{
 			SimulationConfigurator sim = new SimulationConfigurator(this.model.getSim());
 			sim.setLocationRelativeTo(this.getParent());
 			sim.setVisible(true);
 		});
-		mntmSimulation.add(mntmConfigureSim);		
+		mnSimulation.add(mntmConfigureSim);		
 	}
 	
 	/**
@@ -92,6 +93,13 @@ public class MenuBar extends JMenuBar {
 	 * Initializes the Help Menu
 	 */
 	private void initializeHelpMenu() {
-		mntmHelp = new JMenu("Help");
+		mnHelp = new JMenu("Help");
+		JMenuItem mntmAbout = new JMenuItem("About");
+		mntmAbout.addActionListener(a -> {
+			AboutPopUp about = new AboutPopUp();
+			about.setLocationRelativeTo(this.getParent());
+			about.setVisible(true);
+		});
+		mnHelp.add(mntmAbout);
 	}
 }

+ 64 - 0
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/popups/AboutPopUp.java

@@ -0,0 +1,64 @@
+package de.tu_darmstadt.tk.SmartHomeNetworkSim.view.popups;
+
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Toolkit;
+
+import javax.swing.JTextArea;
+import javax.swing.UIManager;
+
+/**
+ * PopUp which shows a short description of the program and developers
+ *
+ * @author Andreas T. Meyer-Berg
+ */
+public class AboutPopUp extends JFrame {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -7426102751026092131L;
+
+	/**
+	 * Create PopUp
+	 */
+	public AboutPopUp() {
+		//Created using Eclipse Window Builder
+		this.setMinimumSize(new Dimension(500, 400));
+		this.setPreferredSize(new Dimension(500, 400));
+		setIconImage(Toolkit.getDefaultToolkit().getImage(
+				AboutPopUp.class
+						.getResource("/images/SmartHomeNetworkSim_icon.jpeg")));
+		setTitle("SmartHomeNetworkSim: About");
+		setFont(new Font("Roboto", Font.PLAIN, 42));
+		getContentPane().setLayout(null);
+
+		JLabel lblSmartHomeNetwork = new JLabel("Smart Home Network Sim");
+		lblSmartHomeNetwork.setFont(new Font("Roboto", Font.PLAIN, 26));
+		lblSmartHomeNetwork.setBounds(12, 13, 458, 51);
+		getContentPane().add(lblSmartHomeNetwork);
+
+		JTextArea txtrSmarthomenetworksim = new JTextArea();
+		txtrSmarthomenetworksim.setWrapStyleWord(true);
+		txtrSmarthomenetworksim.setBackground(UIManager
+				.getColor("Button.background"));
+		txtrSmarthomenetworksim.setEditable(false);
+		txtrSmarthomenetworksim.setLineWrap(true);
+		txtrSmarthomenetworksim.setFont(new Font("Roboto", Font.PLAIN, 16));
+		txtrSmarthomenetworksim
+				.setText("The SmartHomeNetworkSim is a framework for visualization and generation of IoT/SmartHome "
+						+ "network traffic. It allows the user to configure an IoT/SmartHome network and simulate it.");
+		txtrSmarthomenetworksim.setBounds(12, 81, 458, 103);
+		getContentPane().add(txtrSmarthomenetworksim);
+
+		JLabel lblDevelopers = new JLabel(
+				"Developer: Andreas T. Meyer-Berg (Bachelor Thesis)");
+		lblDevelopers.setFont(new Font("Roboto", Font.PLAIN, 16));
+		lblDevelopers.setBounds(12, 260, 458, 51);
+		getContentPane().add(lblDevelopers);
+		// TODO Auto-generated constructor stub
+	}
+}