// Methods public WeigthsNetworkWindow( String title, NetworkPainter networkPainter, Map<Tuple<Id<TransitStopFacility>, Id<ActivityFacility>>, Tuple<Boolean, Double>> ids, SortedMap<Id<ActivityFacility>, MPAreaData> dataMPAreas, SortedMap<String, Coord> stopsBase) { setTitle(title); setDefaultCloseOperation(HIDE_ON_CLOSE); this.setLocation(0, 0); this.setLayout(new BorderLayout()); layersPanels.put( PanelIds.ONE, new WeigthsNetworkPanel(this, networkPainter, ids, dataMPAreas, stopsBase)); this.add(layersPanels.get(PanelIds.ONE), BorderLayout.CENTER); option = Option.ZOOM; JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout(new GridLayout(Option.values().length, 1)); for (Option option : Option.values()) { JButton optionButton = new JButton(option.getCaption()); optionButton.setActionCommand(option.getCaption()); optionButton.addActionListener(this); buttonsPanel.add(optionButton); } this.add(buttonsPanel, BorderLayout.EAST); JPanel infoPanel = new JPanel(); infoPanel.setLayout(new BorderLayout()); readyButton = new JButton("Ready to exit"); readyButton.addActionListener(this); readyButton.setActionCommand(READY_TO_EXIT); infoPanel.add(readyButton, BorderLayout.WEST); JPanel labelsPanel = new JPanel(); labelsPanel.setLayout(new GridLayout(1, Labels.values().length)); labelsPanel.setBorder(new TitledBorder("Information")); labels = new JTextField[Labels.values().length]; for (int i = 0; i < Labels.values().length; i++) { labels[i] = new JTextField(""); labels[i].setEditable(false); labels[i].setBackground(null); labels[i].setBorder(null); labelsPanel.add(labels[i]); } infoPanel.add(labelsPanel, BorderLayout.CENTER); JPanel coordsPanel = new JPanel(); coordsPanel.setLayout(new GridLayout(1, 2)); coordsPanel.setBorder(new TitledBorder("Coordinates")); coordsPanel.add(lblCoords[0]); coordsPanel.add(lblCoords[1]); infoPanel.add(coordsPanel, BorderLayout.EAST); this.add(infoPanel, BorderLayout.SOUTH); setSize( Toolkit.getDefaultToolkit().getScreenSize().width, Toolkit.getDefaultToolkit().getScreenSize().height); }
// Methods public BusLaneAdderWindow( String title, Network network, File imageFile, double[] upLeft, double[] downRight, String finalNetworkFile, CoordinateTransformation coordinateTransformation) throws IOException { setTitle(title); this.finalNetworkFile = finalNetworkFile; this.network = network; NetworkTwoNodesPainter networkPainter = new NetworkTwoNodesPainter(network, Color.BLACK); setDefaultCloseOperation(EXIT_ON_CLOSE); this.setLocation(0, 0); this.setLayout(new BorderLayout()); layersPanels.put( PanelIds.ONE, new BusLaneAdderPanel( this, networkPainter, imageFile, upLeft, downRight, coordinateTransformation)); this.add(layersPanels.get(PanelIds.ONE), BorderLayout.CENTER); option = Options.ZOOM; JPanel toolsPanel = new JPanel(); toolsPanel.setLayout(new GridBagLayout()); for (Tool tool : Tool.values()) { JButton toolButton = new JButton(tool.caption); toolButton.setActionCommand(tool.name()); toolButton.addActionListener(this); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = tool.gx; gbc.gridy = tool.gy; gbc.gridwidth = tool.sx; gbc.gridheight = tool.sy; toolsPanel.add(toolButton, gbc); } this.add(toolsPanel, BorderLayout.NORTH); JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout(new GridLayout(Options.values().length, 1)); for (Options option : Options.values()) { JButton optionButton = new JButton(option.getCaption()); optionButton.setActionCommand(option.getCaption()); optionButton.addActionListener(this); buttonsPanel.add(optionButton); } this.add(buttonsPanel, BorderLayout.EAST); JPanel infoPanel = new JPanel(); infoPanel.setLayout(new BorderLayout()); readyButton = new JButton("Ready to exit"); readyButton.addActionListener(this); readyButton.setActionCommand(READY_TO_EXIT); infoPanel.add(readyButton, BorderLayout.WEST); JPanel labelsPanel = new JPanel(); labelsPanel.setLayout(new GridLayout(1, Labels.values().length)); labelsPanel.setBorder(new TitledBorder("Information")); labels = new JTextField[Labels.values().length]; for (int i = 0; i < Labels.values().length; i++) { labels[i] = new JTextField(""); labels[i].setEditable(false); labels[i].setBackground(null); labels[i].setBorder(null); labelsPanel.add(labels[i]); } infoPanel.add(labelsPanel, BorderLayout.CENTER); JPanel coordsPanel = new JPanel(); coordsPanel.setLayout(new GridLayout(1, 2)); coordsPanel.setBorder(new TitledBorder("Coordinates")); coordsPanel.add(lblCoords[0]); coordsPanel.add(lblCoords[1]); infoPanel.add(coordsPanel, BorderLayout.EAST); this.add(infoPanel, BorderLayout.SOUTH); super.setSize( Toolkit.getDefaultToolkit().getScreenSize().width, Toolkit.getDefaultToolkit().getScreenSize().height); }