Procházet zdrojové kódy

split view ansatz und console runter

Kevin Trometer před 7 roky
rodič
revize
5a68d4d5d8
2 změnil soubory, kde provedl 42 přidání a 8 odebrání
  1. 35 2
      src/ui/view/GUI.java
  2. 7 6
      src/ui/view/UnitGraph.java

+ 35 - 2
src/ui/view/GUI.java

@@ -123,6 +123,9 @@ public class GUI<E> implements CategoryListener {
 	private final JScrollPane scrollPane1 = new JScrollPane();
 	// private final JScrollPane holonSP = new JScrollPane();
 	private final JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
+	private final JTabbedPane tabbedPane2 = new JTabbedPane(JTabbedPane.TOP);
+	private final JButton splitButton = new JButton("Split View");
+
 	private final JPanel panelTapped_SimMenu = new JPanel();
 	private JPopupMenu popmenuEdit = new JPopupMenu();
 	private JMenuItem editItem = new JMenuItem("Edit Object");
@@ -754,6 +757,35 @@ public class GUI<E> implements CategoryListener {
 
 		mnHelp.add(aboutUs);
 
+		// Testing
+		menuBar.add(splitButton);
+		//Split View
+		splitButton.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				if (panelTapped_SimMenu
+						.getComponent(panelTapped_SimMenu.getComponentCount() - 1) instanceof JSplitPane) {
+					tabbedPane2.removeAll();
+					panelTapped_SimMenu
+							.remove(panelTapped_SimMenu.getComponent(panelTapped_SimMenu.getComponentCount() - 1));
+					panelTapped_SimMenu.add(tabbedPane);
+				} else {
+					for (int i = 0; i < tabbedPane.getTabCount(); i++) {
+						tabbedPane2.addTab(tabbedPane.getTitleAt(i), null);
+					}
+					JSplitPane tempSplit = new JSplitPane();
+					tempSplit.setBorder(null);
+					tempSplit.setRightComponent(tabbedPane2);
+					tempSplit.setLeftComponent(tabbedPane);
+					tempSplit.setDividerLocation(tabbedPane.getWidth()/2);
+					panelTapped_SimMenu.remove(tabbedPane);
+					panelTapped_SimMenu.add(tempSplit);
+				}
+				contentPane.updateUI();
+			}
+
+		});
+
 		mnNewMenuOptions.add(mnLanguage);
 		canvas.setBackground(Color.WHITE);
 		canvas.setPreferredSize(new Dimension(model.getCanvasX(), model.getCanvasY()));
@@ -1759,8 +1791,9 @@ public class GUI<E> implements CategoryListener {
 		splitPane.setRightComponent(splitPane1);
 		splitPane.setDividerLocation(200);
 		splitPane1.setDividerLocation(500);
-		splitPaneCanvasConsole.setDividerLocation(500);
-
+		splitPaneCanvasConsole.setDividerLocation(550);
+		splitPaneCanvasConsole.setResizeWeight(0.9);
+		
 		splitPane.setLeftComponent(scrollPane1);
 		splitPaneCanvasConsole.setLeftComponent(panelTapped_SimMenu);
 		tabbedPane.addTab("View", canvasSP);

+ 7 - 6
src/ui/view/UnitGraph.java

@@ -156,13 +156,14 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 
 			/*
 			 * // Actual Iteration Point Visualization g2.setColor(Color.RED);
-			 * if (arrayOfValue != null) { for (int i = 0; i <
-			 * arrayOfValue.length; i++) { g2.fillOval((int) (i * width /
+			 * if (arrayOfFloats != null) { for (int i = 0; i <
+			 * arrayOfFloats.length; i++) { g2.fillOval((int) (i * width /
 			 * (model.getIterations() - 1) * scaleX - recSize.getX() / 2), (int)
-			 * (convertToCanvasY((int) arrayOfValue[i]) * scaleY -
+			 * (convertToCanvasY((int) arrayOfFloats[i]) * scaleY -
 			 * recSize.getY() / 2), (int) recSize.getX(), (int) recSize.getY());
 			 * } }
 			 */
+
 		} else if (isSwitch) {
 			if (arrayOfBooleans != null) {
 				// array fillen
@@ -517,8 +518,8 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 	public void reset() {
 		pointList.removeAll(pointList);
 		if (isSwitch) {
-			pointList.addFirst(new Point(-4, (int)(height/6)));
-			pointList.addLast(new Point((int) (width)+4, (int) (height / 6)));
+			pointList.addFirst(new Point(-4, (int) (height / 6)));
+			pointList.addLast(new Point((int) (width) + 4, (int) (height / 6)));
 		} else {
 			pointList.addFirst(new Point(0, 0));
 			pointList.addLast(new Point((int) (this.getWidth() / scaleX), 0));
@@ -583,7 +584,7 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
 		// First time clicked on the Element
 		if (pointList.isEmpty()) {
 			pointList.addFirst(new Point(-4, (int) (height / 6)));
-			pointList.addLast(new Point((int) (width)+4, (int) (height / 6)));
+			pointList.addLast(new Point((int) (width) + 4, (int) (height / 6)));
 		}
 		repaint();
 	}