- JPanel dialogPanel = new JPanel();
- dialogPanel.setLayout(new BorderLayout());
-
- // Status label
- _statusLabel = new JLabel(I18nManager.getText("confirm.running"));
- dialogPanel.add(_statusLabel, BorderLayout.NORTH);
- // Main panel with track list
- _trackListModel = new TrackListModel();
- _trackTable = new JTable(_trackListModel);
- _trackTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
- public void valueChanged(ListSelectionEvent e) {
- if (!e.getValueIsAdjusting())
- {
- if (_trackTable.getSelectedRow() >= 0
- && _trackTable.getSelectedRow() < _trackListModel.getRowCount())
- {
- _loadButton.setEnabled(true);
- _showButton.setEnabled(true);
- setDescription(_trackListModel.getTrack(_trackTable.getSelectedRow()).getDescription());
- _descriptionBox.setCaretPosition(0);
- }
- else {
- _descriptionBox.setText("");
- }
- }
- }
- });
- _trackTable.getColumnModel().getColumn(0).setPreferredWidth(300);
- _trackTable.getColumnModel().getColumn(1).setPreferredWidth(70);
- JScrollPane tablePane = new JScrollPane(_trackTable);
- tablePane.setPreferredSize(new Dimension(450, 200));
- // Panel to hold description label and box
- JPanel descPanel = new JPanel();
- descPanel.setLayout(new BorderLayout());
- JLabel descLabel = new JLabel(I18nManager.getText("dialog.gpsies.description") + " :");
- descPanel.add(descLabel, BorderLayout.NORTH);
- _descriptionBox = new JTextArea(5, 20);
- _descriptionBox.setEditable(false);
- _descriptionBox.setLineWrap(true);
- _descriptionBox.setWrapStyleWord(true);
- JScrollPane descPane = new JScrollPane(_descriptionBox);
- descPane.setPreferredSize(new Dimension(400, 80));
- descPanel.add(descPane, BorderLayout.CENTER);
- // Use split pane to split table from description
- JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, tablePane, descPanel);
- splitPane.setResizeWeight(1.0);
- dialogPanel.add(splitPane, BorderLayout.CENTER);
-
- // button panel at bottom
- JPanel buttonPanel = new JPanel();
- buttonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
- _loadButton = new JButton(I18nManager.getText("button.load"));
- _loadButton.setEnabled(false);
- _loadButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e)
- {
- loadSelectedTrack();
- }
- });
- buttonPanel.add(_loadButton);
- _showButton = new JButton(I18nManager.getText("button.showwebpage"));
- _showButton.setEnabled(false);
- _showButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e)
- {
- showSelectedTrack();
- }
- });
- buttonPanel.add(_showButton);
- JButton cancelButton = new JButton(I18nManager.getText("button.cancel"));
- cancelButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e)
- {
- _cancelled = true;
- _dialog.dispose();
- }
- });
- buttonPanel.add(cancelButton);
- dialogPanel.add(buttonPanel, BorderLayout.SOUTH);
- dialogPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 15));
- return dialogPanel;