Browse Source

combobox variation

jess 8 years ago
parent
commit
2802f8595f
1 changed files with 15 additions and 18 deletions
  1. 15 18
      src/ui/view/GUI.java

+ 15 - 18
src/ui/view/GUI.java

@@ -75,7 +75,9 @@ import classes.HolonSwitch;
 import classes.HolonTransformer;
 import classes.Position;
 import ui.controller.Control;
-import ui.model.Model;;
+import ui.model.Model;
+import javax.swing.JList;
+import javax.swing.Box;;
 
 public class GUI<E> implements CategoryListener {
 
@@ -184,8 +186,6 @@ public class GUI<E> implements CategoryListener {
 	private TimePanel timePanel;
 	private final JMenu mnAlgorithm = new JMenu("Algorithm");
 	private final JCheckBoxMenuItem chckbxmntmUseAlgorithm = new JCheckBoxMenuItem("Use Algorithm");
-	private final JSplitPane splitPane_2 = new JSplitPane();
-	private final JLabel lblSelect = new JLabel("Select");
 	private final JComboBox comboBoxAlgo = new JComboBox();
 	private int yTHIS;
 	private int xTHIS;
@@ -448,9 +448,9 @@ public class GUI<E> implements CategoryListener {
 		mnNewMenu_2.add(mntmEditEdges);
 
 		mnNewMenu_2.add(mntmResetCategory);
-		
+
 		mnNewMenu_2.add(mnSimulationSpeed);
-		
+
 		mnSimulationSpeed.add(simulationSpeedField);
 		mntmResetCategory.addActionListener(new ActionListener() {
 
@@ -506,17 +506,11 @@ public class GUI<E> implements CategoryListener {
 		mnHelp.add(aboutUs);
 
 		menuBar.add(mnAlgorithm);
-		
+
 		mnAlgorithm.add(mntmSetFolder);
 
 		mnAlgorithm.add(chckbxmntmUseAlgorithm);
 
-		mnAlgorithm.add(splitPane_2);
-
-		splitPane_2.setLeftComponent(lblSelect);
-
-		splitPane_2.setRightComponent(comboBoxAlgo);
-
 		canvas.setBackground(Color.WHITE);
 		canvas.setPreferredSize(new Dimension(1000, 1000));
 		JScrollPane canvasSP = new JScrollPane(canvas);
@@ -1387,7 +1381,7 @@ public class GUI<E> implements CategoryListener {
 			}
 
 		});
-		
+
 		mntmSetFolder.addActionListener(new java.awt.event.ActionListener() {
 
 			@Override
@@ -1402,11 +1396,13 @@ public class GUI<E> implements CategoryListener {
 				JFrame test = new JFrame();
 				fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
 				fileChooser.setAcceptAllFileFilterUsed(false);
-				
+
 				if (fileChooser.showOpenDialog(test) == JFileChooser.APPROVE_OPTION) {
 					File[] files = fileChooser.getSelectedFile().listFiles();
-					for(int i=0; i < files.length; i++){
-						comboBoxAlgo.addItem(files[i]);
+					for (int i = 0; i < files.length; i++) {
+						if (files[i].toString().endsWith(".java") || files[i].toString().endsWith(".class")) {
+							comboBoxAlgo.addItem(files[i]);
+						}
 					}
 				}
 			}
@@ -1452,7 +1448,7 @@ public class GUI<E> implements CategoryListener {
 		tableHolonElementScrollPane.setBorder(null);
 
 		frmCyberPhysical.getContentPane().add(timePanel, BorderLayout.SOUTH);
-		
+
 		simulationSpeedField.setText(Integer.toString(timePanel.getTimerSpeed()));
 		btnApply.addActionListener(new ActionListener() {
 			public void actionPerformed(ActionEvent e) {
@@ -1461,8 +1457,9 @@ public class GUI<E> implements CategoryListener {
 				mnSimulationSpeed.setPopupMenuVisible(false);
 			}
 		});
-		
+
 		mnSimulationSpeed.add(btnApply);
+		menuBar.add(comboBoxAlgo);
 	}
 
 	/*