Browse Source

Merge branch 'Ohne_Drag_and_Drop' of https://git.tk.informatik.tu-darmstadt.de/carlos.garcia/praktikum-holons into Ohne_Drag_and_Drop

dominik.rieder 8 years ago
parent
commit
a2d740365a
2 changed files with 28 additions and 1 deletions
  1. 27 0
      src/ui/view/GUI.java
  2. 1 1
      src/ui/view/MyCanvas.java

+ 27 - 0
src/ui/view/GUI.java

@@ -10,6 +10,10 @@ import java.awt.Point;
 import java.awt.Toolkit;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 import java.beans.PropertyChangeEvent;
@@ -18,12 +22,16 @@ import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 
+import javax.swing.AbstractAction;
+import javax.swing.ActionMap;
 import javax.swing.BoxLayout;
 import javax.swing.DefaultComboBoxModel;
 import javax.swing.ImageIcon;
+import javax.swing.InputMap;
 import javax.swing.JButton;
 import javax.swing.JCheckBoxMenuItem;
 import javax.swing.JComboBox;
+import javax.swing.JComponent;
 import javax.swing.JEditorPane;
 import javax.swing.JFileChooser;
 import javax.swing.JFrame;
@@ -42,6 +50,7 @@ import javax.swing.JTable;
 import javax.swing.JTextField;
 import javax.swing.JToolBar;
 import javax.swing.JTree;
+import javax.swing.KeyStroke;
 import javax.swing.SwingUtilities;
 import javax.swing.border.LineBorder;
 import javax.swing.event.ChangeEvent;
@@ -230,6 +239,24 @@ public class GUI<E> implements CategoryListener {
 			}
 		});
 
+		
+
+		JPanel contentPane = (JPanel) frmCyberPhysical.getContentPane();
+
+		int condition = JComponent.WHEN_IN_FOCUSED_WINDOW;
+		InputMap inputMap = contentPane.getInputMap(condition);
+		ActionMap actionMap = contentPane.getActionMap();
+
+		String zDown = "z";
+		inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_Z, 0), zDown);
+		actionMap.put(zDown, new AbstractAction() {
+			@Override
+			public void actionPerformed(ActionEvent arg0) {
+				System.out.println("z");
+			}
+		});
+		
+
 		frmCyberPhysical.setJMenuBar(menuBar);
 
 		frmCyberPhysical.setIconImage(new ImageIcon(this.getClass().getResource("/Images/Dummy_House.png")).getImage()

+ 1 - 1
src/ui/view/MyCanvas.java

@@ -77,7 +77,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		this.controller = control;
 		this.model = model;
 
-		edgeCapacity = 100;
+		edgeCapacity = 10000;
 		popmenu.add(itemDelete);
 		itemDelete.setEnabled(false);
 		itemDelete.addActionListener(new ActionListener() {