From: Meryem Esa Date: Sun, 31 Jan 2016 00:57:05 +0000 (-0800) Subject: make a method for initializing all the Sendable Choosers X-Git-Url: http://challenge-bot.com/repos/?p=3501%2Fstronghold-2016;a=commitdiff_plain;h=6947c8a4fbc2b4b6fe8e5a68ee477c82f8a4b0b2 make a method for initializing all the Sendable Choosers --- 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);