From 6947c8a4fbc2b4b6fe8e5a68ee477c82f8a4b0b2 Mon Sep 17 00:00:00 2001 From: Meryem Esa Date: Sat, 30 Jan 2016 16:57:05 -0800 Subject: [PATCH] make a method for initializing all the Sendable Choosers --- src/org/usfirst/frc/team3501/robot/Robot.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/org/usfirst/frc/team3501/robot/Robot.java b/src/org/usfirst/frc/team3501/robot/Robot.java index 1ebdf64b..37b3c246 100644 --- a/src/org/usfirst/frc/team3501/robot/Robot.java +++ b/src/org/usfirst/frc/team3501/robot/Robot.java @@ -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); -- 2.30.2