Kaynağa Gözat

AddElementPopUp bearbeitet

dominik.rieder 8 yıl önce
ebeveyn
işleme
0229865005

BIN
bin/ui/view/AddElementPopUp.class


BIN
bin/ui/view/AddObjectPopUp.class


BIN
res/Images/house.png


+ 42 - 3
src/ui/view/AddElementPopUp.java

@@ -7,10 +7,17 @@ import javax.swing.JButton;
 import javax.swing.JDialog;
 import javax.swing.JPanel;
 import javax.swing.border.EmptyBorder;
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+import javax.swing.JComboBox;
+import javax.swing.DefaultComboBoxModel;
 
 public class AddElementPopUp extends JDialog {
 
 	private final JPanel contentPanel = new JPanel();
+	private JTextField textField;
+	private JTextField textField_1;
+	private JTextField textField_2;
 
 	/**
 	 * Launch the application.
@@ -29,11 +36,44 @@ public class AddElementPopUp extends JDialog {
 	 * Create the dialog.
 	 */
 	public AddElementPopUp() {
-		setBounds(100, 100, 450, 300);
+		setBounds(100, 100, 300, 190);
 		getContentPane().setLayout(new BorderLayout());
-		contentPanel.setLayout(new FlowLayout());
 		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
 		getContentPane().add(contentPanel, BorderLayout.CENTER);
+		contentPanel.setLayout(null);
+		this.setTitle("Add default Element to Object");
+		
+		JLabel lblElementName = new JLabel("Element Name:");
+		lblElementName.setBounds(10, 11, 79, 14);
+		contentPanel.add(lblElementName);
+		
+		JLabel lblProvidedEnergy = new JLabel("Provided Energy:");
+		lblProvidedEnergy.setBounds(10, 49, 90, 14);
+		contentPanel.add(lblProvidedEnergy);
+		
+		JLabel lblAmount = new JLabel("Amount:");
+		lblAmount.setBounds(10, 84, 46, 14);
+		contentPanel.add(lblAmount);
+		
+		textField = new JTextField();
+		textField.setBounds(140, 8, 110, 20);
+		contentPanel.add(textField);
+		textField.setColumns(10);
+		
+		JComboBox comboBox = new JComboBox();
+		comboBox.setModel(new DefaultComboBoxModel(new String[] {"+", "-"}));
+		comboBox.setBounds(100, 46, 33, 20);
+		contentPanel.add(comboBox);
+		
+		textField_1 = new JTextField();
+		textField_1.setBounds(140, 46, 110, 20);
+		contentPanel.add(textField_1);
+		textField_1.setColumns(10);
+		
+		textField_2 = new JTextField();
+		textField_2.setBounds(140, 81, 110, 20);
+		contentPanel.add(textField_2);
+		textField_2.setColumns(10);
 		{
 			JPanel buttonPane = new JPanel();
 			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
@@ -51,5 +91,4 @@ public class AddElementPopUp extends JDialog {
 			}
 		}
 	}
-
 }

+ 8 - 0
src/ui/view/AddObjectPopUp.java

@@ -19,6 +19,7 @@ import javax.swing.SwingConstants;
 public class AddObjectPopUp extends JDialog {
 
 	private final JPanel contentPanel = new JPanel();
+	private AddElementPopUp addElement;
 	private JTextField textField;
 	private JTextField textField_1;
 
@@ -44,6 +45,7 @@ public class AddObjectPopUp extends JDialog {
 		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
 		getContentPane().add(contentPanel, BorderLayout.CENTER);
 		contentPanel.setLayout(null);
+		this.setTitle("Add Object Menu");
 		{
 			JLabel lblName = new JLabel("Name:");
 			lblName.setHorizontalAlignment(SwingConstants.CENTER);
@@ -112,6 +114,12 @@ public class AddObjectPopUp extends JDialog {
 		}
 		{
 			JButton btnAddDefaultElement = new JButton("Add Default Element");
+			btnAddDefaultElement.addActionListener(new ActionListener() {
+				public void actionPerformed(ActionEvent arg0) {
+					addElement = new AddElementPopUp();
+					addElement.setVisible(true);
+				}
+			});
 			btnAddDefaultElement.setBounds(262, 95, 144, 23);
 			contentPanel.add(btnAddDefaultElement);
 		}