001 /*----------------------------------------------------------------------------*/ 002 /* Copyright (c) FIRST 2008-2012. All Rights Reserved. */ 003 /* Open Source Software - may be modified and shared by FRC teams. The code */ 004 /* must be accompanied by the FIRST BSD license file in the root directory of */ 005 /* the project. */ 006 /*----------------------------------------------------------------------------*/ 007 008 package edu.wpi.first.wpilibj.buttons; 009 010 import edu.wpi.first.wpilibj.networktables.NetworkTable; 011 012 /** 013 * 014 * @author Joe 015 */ 016 public class NetworkButton extends Button { 017 018 NetworkTable table; 019 String field; 020 021 public NetworkButton(String table, String field) { 022 this(NetworkTable.getTable(table), field); 023 } 024 025 public NetworkButton(NetworkTable table, String field) { 026 this.table = table; 027 this.field = field; 028 } 029 030 public boolean get() { 031 return table.isConnected() && table.getBoolean(field, false); 032 } 033 }