make a method for initializing all the Sendable Choosers
authorMeryem Esa <meresa14@gmail.com>
Sun, 31 Jan 2016 00:57:05 +0000 (16:57 -0800)
committerMeryem Esa <meresa14@gmail.com>
Sun, 31 Jan 2016 01:10:57 +0000 (17:10 -0800)
src/org/usfirst/frc/team3501/robot/Robot.java

index 1ebdf64bfbd55cdd81110f8a7873304e26c93694..37b3c24671f8b6c96d8e879c1d53d756729c8dba 100644 (file)
@@ -16,7 +16,8 @@ public class Robot extends IterativeRobot {
 
   // Sendable Choosers send a drop down menu to the Smart Dashboard.
   SendableChooser positionChooser;
-  SendableChooser positionOneDefense, positionTwoDefense, positionThreeDefense, positionFourDefense, positionFiveDefense;
+  SendableChooser positionOneDefense, positionTwoDefense, positionThreeDefense,
+      positionFourDefense, positionFiveDefense;
 
   @Override
   public void robotInit() {
@@ -24,13 +25,7 @@ public class Robot extends IterativeRobot {
     oi = new OI();
     shooter = new Shooter();
 
-    // initialize all the Sendable Choosers
-    positionChooser = new SendableChooser();
-    positionOneDefense = new SendableChooser();
-    positionTwoDefense = new SendableChooser();
-    positionThreeDefense = new SendableChooser();
-    positionFourDefense = new SendableChooser();
-    positionFiveDefense = new SendableChooser();
+    initializeSendableChoosers();
 
     // add options for positions to the positionChooser
     positionChooser.addDefault("Position 1", 1);
@@ -61,6 +56,16 @@ public class Robot extends IterativeRobot {
         positionFiveDefense);
   }
 
+  // initialize all the Sendable Choosers
+  private void initializeSendableChoosers() {
+    positionChooser = new SendableChooser();
+    positionOneDefense = new SendableChooser();
+    positionTwoDefense = new SendableChooser();
+    positionThreeDefense = new SendableChooser();
+    positionFourDefense = new SendableChooser();
+    positionFiveDefense = new SendableChooser();
+  }
+
   private void addDefense(SendableChooser chooser) {
     chooser.addDefault("Portcullis", Defense.PORTCULLIS);
     chooser.addObject("Sally Port", Defense.SALLY_PORT);