View Javadoc
1   package nl.tudelft.simulation.dsol.swing.statistics;
2   
3   import java.awt.Container;
4   import java.rmi.RemoteException;
5   
6   import javax.swing.BorderFactory;
7   import javax.swing.JScrollPane;
8   import javax.swing.JTable;
9   import javax.swing.border.EtchedBorder;
10  
11  import nl.tudelft.simulation.dsol.statistics.table.StatisticsTableModel;
12  import nl.tudelft.simulation.dsol.swing.Swingable;
13  
14  /**
15   * StatisticsTable.java.
16   * <p>
17   * Copyright (c) 2020-2023 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
18   * for project information <a href="https://simulation.tudelft.nl/dsol/manual/" target="_blank">DSOL Manual</a>. The DSOL
19   * project is distributed under a three-clause BSD-style license, which can be found at
20   * <a href="https://https://simulation.tudelft.nl/dsol/docs/latest/license.html" target="_blank">DSOL License</a>.
21   * </p>
22   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
23   * @author <a href="https://www.tudelft.nl/pknoppers">Peter Knoppers</a>
24   * @author <a href="https://www.transport.citg.tudelft.nl">Wouter Schakel</a>
25   */
26  public class StatisticsTable implements Swingable
27  {
28      /** the statistics table that is represented on the screen. */
29      private final StatisticsTableModel table;
30  
31      /**
32       * Constructor.
33       * @param table StatisticsTableModel; the statistics table that is represented on the screen
34       */
35      public StatisticsTable(final StatisticsTableModel table)
36      {
37          this.table = table;
38      }
39  
40      /**
41       * represents this statisticsObject as Container.
42       * @return Container; the result
43       * @throws RemoteException on network failure
44       */
45      @Override
46      public Container getSwingPanel() throws RemoteException
47      {
48          JTable jTable = new JTable(this.table);
49          jTable.setEnabled(false);
50          JScrollPane pane = new JScrollPane(jTable);
51          pane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
52          return pane;
53      }
54  }