diff options
Diffstat (limited to 'src/main/java/com/benburwell/planes/gui/Main1090.java')
-rw-r--r-- | src/main/java/com/benburwell/planes/gui/Main1090.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main/java/com/benburwell/planes/gui/Main1090.java b/src/main/java/com/benburwell/planes/gui/Main1090.java index 962e428..b0847bd 100644 --- a/src/main/java/com/benburwell/planes/gui/Main1090.java +++ b/src/main/java/com/benburwell/planes/gui/Main1090.java @@ -4,6 +4,8 @@ package com.benburwell.planes.gui; +import com.benburwell.planes.gui.aircrafttable.AircraftTableComponent; +import com.benburwell.planes.gui.navigationaids.NavigationAidComponent; import com.benburwell.planes.sbs.*; import com.benburwell.planes.data.*; import com.benburwell.planes.gui.aircraftmap.*; @@ -16,8 +18,8 @@ import java.io.IOException; public class Main1090 extends JFrame { private AggregateDataSource sbsDataSource = new AggregateDataSource(); private AircraftStore aircraft = new AircraftStore(); - private NavigationAidStore navaids = new NavigationAidStore(); - private AirportStore airports = new AirportStore(); + private CSVObjectStore<NavigationAid> navaids = new CSVObjectStore<>(); + private CSVObjectStore<Airport> airports = new CSVObjectStore<>(); private int currentTcpConnection = 0; private JTabbedPane tabbedPane = new JTabbedPane(); @@ -36,14 +38,14 @@ public class Main1090 extends JFrame { this.openDataSource(); try { - this.navaids.readFromFile("/home/ben/.airdata/navaids.csv"); - } catch (IOException e) { + this.navaids.readFromResource("/navaids.csv", NavigationAid.class); + } catch (IOException | InstantiationException | IllegalAccessException e) { System.out.println("Could not read navaid file: " + e.getMessage()); } try { - this.airports.readFromFile("/home/ben/.airdata/airports.csv"); - } catch (IOException e) { + this.airports.readFromResource("/airports.csv", Airport.class); + } catch (IOException | InstantiationException | IllegalAccessException e) { System.out.println("Could not read airport file: " + e.getMessage()); } @@ -51,19 +53,17 @@ public class Main1090 extends JFrame { } private void createTabs() { - AircraftTableComponent aircraftData = new AircraftTableComponent(this.aircraft); - this.tabbedPane.addTab("Aircraft Data", aircraftData.getComponent()); - AircraftMapComponent aircraftMap = new AircraftMapComponent(this.aircraft, this.navaids, this.airports); this.tabbedPane.addTab("Live Map", aircraftMap.getComponent()); + AircraftTableComponent aircraftData = new AircraftTableComponent(this.aircraft); + this.tabbedPane.addTab("Aircraft Data", aircraftData.getComponent()); + NavigationAidComponent navaids = new NavigationAidComponent(this.navaids); this.tabbedPane.addTab("Navigation Aids", navaids.getComponent()); this.add(this.tabbedPane); this.tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); - - this.tabbedPane.setSelectedIndex(1); } private void createMenuBar() { |