simple Street table
This commit is contained in:
parent
6720b412e6
commit
da959a5cd3
@ -1,3 +1,8 @@
|
|||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.table.TableColumn;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
@ -47,6 +52,34 @@ public class MakkahCity {
|
|||||||
|
|
||||||
makeRoutes();
|
makeRoutes();
|
||||||
|
|
||||||
|
Object[][] streetData = new Object[stdStreet.length][6];
|
||||||
|
String[] colNames = new String[]{
|
||||||
|
"Street name",
|
||||||
|
"Street Load",
|
||||||
|
"Total",
|
||||||
|
"Buses",
|
||||||
|
"Local Vehicles",
|
||||||
|
"Avg. Time"
|
||||||
|
};
|
||||||
|
for (int i = 0; i < stdStreet.length; i++) {
|
||||||
|
streetData[i][0] = stdStreet[i].getName().name();
|
||||||
|
streetData[i][1] = stdStreet[i].getPercentRemainingCapacity();
|
||||||
|
streetData[i][2] = stdStreet[i].getVehicles().size();
|
||||||
|
streetData[i][3] = stdStreet[i].getNumberOfBuses();
|
||||||
|
streetData[i][4] = stdStreet[i].getNumberOfLocalCars();
|
||||||
|
streetData[i][5] = avgTimeOnStreet(stdStreet[i]);
|
||||||
|
}
|
||||||
|
JFrame frame = new JFrame("Streets");
|
||||||
|
JPanel panel = new JPanel(new GridLayout());
|
||||||
|
JTable table = new JTable(streetData,colNames);
|
||||||
|
Button btn = new Button("OK");
|
||||||
|
panel.add(table);
|
||||||
|
panel.add(btn);
|
||||||
|
frame.add(panel);
|
||||||
|
frame.setSize(500,500);
|
||||||
|
frame.setVisible(true);
|
||||||
|
|
||||||
|
|
||||||
//Set Routes for Campaigns
|
//Set Routes for Campaigns
|
||||||
setRoutesForCampaigns(Mashier.ARAFAT);
|
setRoutesForCampaigns(Mashier.ARAFAT);
|
||||||
while(!firstDayTimeMan.isEnded()) {
|
while(!firstDayTimeMan.isEnded()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user