diff --git a/src/main/java/edu/wpi/first/smartdashboard/gui/DashboardFrame.java b/src/main/java/edu/wpi/first/smartdashboard/gui/DashboardFrame.java index c20adf3..99a8f53 100644 --- a/src/main/java/edu/wpi/first/smartdashboard/gui/DashboardFrame.java +++ b/src/main/java/edu/wpi/first/smartdashboard/gui/DashboardFrame.java @@ -10,6 +10,8 @@ import edu.wpi.first.smartdashboard.xml.SmartDashboardXMLReader; import edu.wpi.first.smartdashboard.xml.SmartDashboardXMLWriter; import edu.wpi.first.smartdashboard.xml.XMLWidget; +import edu.wpi.first.wpilibj.networktables.NetworkTable; +import edu.wpi.first.wpilibj.networktables.NetworkTablesJNI; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Dimension; @@ -38,6 +40,8 @@ */ public class DashboardFrame extends JFrame { + private static final String TITLE = "SmartDashboard | "; + /* * If the menu bar is set to "hidden," then this defines what portion of the * top screen is reserved for revealing the menu bar when the mouse moves @@ -96,7 +100,18 @@ public static DashboardFrame getInstance() { * @param competition whether or not to display as though it were on the netbook */ public DashboardFrame(boolean competition) { - super("SmartDashboard - "); + NetworkTablesJNI.ConnectionListenerFunction clf = (uid, connected, conn) -> { + if (NetworkTable.getTable("").isServer()) { + setTitle(TITLE + "Number of Clients: " + NetworkTablesJNI.getConnections().length); + } else if (connected && conn != null) { + setTitle(TITLE + "Connected: " + conn.remote_ip); + } else { + setTitle(TITLE + "Disconnected"); + } + }; + clf.apply(0, false, null); + + NetworkTablesJNI.addConnectionListener(clf, true); setLayout(new BorderLayout()); diff --git a/src/main/java/edu/wpi/first/smartdashboard/gui/DashboardPrefs.java b/src/main/java/edu/wpi/first/smartdashboard/gui/DashboardPrefs.java index 2ca8f55..3da9d58 100644 --- a/src/main/java/edu/wpi/first/smartdashboard/gui/DashboardPrefs.java +++ b/src/main/java/edu/wpi/first/smartdashboard/gui/DashboardPrefs.java @@ -117,7 +117,6 @@ public void propertyChanged(Property property) { frame.setSize(frame.getWidth(), height.getValue()); } else if (property == team) { Robot.setTeam(team.getValue()); - frame.setTitle("SmartDashboard - " + team.getValue()); } else if (property == hideMenu) { frame.setShouldHideMenu(hideMenu.getValue()); } else if (property == logToCSV) {