summaryrefslogtreecommitdiff
path: root/src/main/java/com/benburwell/planes/gui/airportstable/AirportsComponent.java
blob: 14eaca9224e6dba35a96eca9e097ca18329e6da1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.benburwell.planes.gui.airportstable;

import com.benburwell.planes.data.Airport;
import com.benburwell.planes.data.CSVObjectStore;
import com.benburwell.planes.gui.Tabbable;
import com.benburwell.planes.gui.navigationaids.AirportsTableModel;

import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.JTable;

/**
 * @author ben
 */
public class AirportsComponent implements Tabbable {
    private JScrollPane scrollPane = new JScrollPane();

    public AirportsComponent(CSVObjectStore<Airport> airportStore) {
        AirportsTableModel tableModel = new AirportsTableModel(airportStore.getObjects());
        JTable table = new JTable(tableModel);
        table.setFillsViewportHeight(true);
        this.scrollPane = new JScrollPane(table);
    }

    @Override
    public JComponent getComponent() {
        return this.scrollPane;
    }

    @Override
    public String getName() {
        return "Airports";
    }
}