1 | package panels;
|
---|
2 |
|
---|
3 | import static org.openstreetmap.josm.tools.I18n.tr;
|
---|
4 |
|
---|
5 | import java.awt.Color;
|
---|
6 | import java.awt.Dimension;
|
---|
7 | import java.awt.Rectangle;
|
---|
8 | import java.awt.event.ActionListener;
|
---|
9 |
|
---|
10 | import javax.swing.*;
|
---|
11 |
|
---|
12 | import org.openstreetmap.josm.Main;
|
---|
13 |
|
---|
14 | import smed2.Smed2Action;
|
---|
15 |
|
---|
16 | public class PanelMain extends JPanel {
|
---|
17 |
|
---|
18 | private static final long serialVersionUID = 1L;
|
---|
19 |
|
---|
20 | private JTabbedPane tabs = null;
|
---|
21 | // public PanelF panelF = null;
|
---|
22 | public static JTextField messageBar = null;
|
---|
23 | public JButton saveButton = null;
|
---|
24 | private ActionListener alSave = new ActionListener() {
|
---|
25 | public void actionPerformed(java.awt.event.ActionEvent e) {
|
---|
26 | // item.saveSign(???);
|
---|
27 | }
|
---|
28 | };
|
---|
29 | private JButton openButton = null;
|
---|
30 | final JFileChooser fc = new JFileChooser();
|
---|
31 | private ActionListener alOpen = new ActionListener() {
|
---|
32 | public void actionPerformed(java.awt.event.ActionEvent e) {
|
---|
33 | if (e.getSource() == openButton) {
|
---|
34 | messageBar.setText("Select file");
|
---|
35 | int returnVal = fc.showOpenDialog(Main.parent);
|
---|
36 | if (returnVal == JFileChooser.APPROVE_OPTION) {
|
---|
37 | Smed2Action.panelS57.startImport(fc.getSelectedFile());
|
---|
38 | } else {
|
---|
39 | messageBar.setText("");
|
---|
40 | }
|
---|
41 | }
|
---|
42 | }
|
---|
43 | };
|
---|
44 |
|
---|
45 | public PanelMain() {
|
---|
46 |
|
---|
47 | setLayout(null);
|
---|
48 | setSize(new Dimension(480, 480));
|
---|
49 | tabs = new JTabbedPane(JTabbedPane.TOP);
|
---|
50 | tabs.setBounds(new Rectangle(0, 0, 480, 420));
|
---|
51 |
|
---|
52 | // JPanel panelF = new PanelF();
|
---|
53 | // tabs.addTab(null, new ImageIcon(getClass().getResource("/images/tabF.png")), panelF, Messages.getString("Ports"));
|
---|
54 |
|
---|
55 | add(tabs);
|
---|
56 |
|
---|
57 | messageBar = new JTextField();
|
---|
58 | messageBar.setBounds(40, 430, 320, 20);
|
---|
59 | messageBar.setEditable(false);
|
---|
60 | messageBar.setBackground(Color.WHITE);
|
---|
61 | add(messageBar);
|
---|
62 | openButton = new JButton(new ImageIcon(getClass().getResource("/images/fileButton.png")));
|
---|
63 | openButton.setBounds(10, 430, 20, 20);
|
---|
64 | add(openButton);
|
---|
65 | openButton.addActionListener(alOpen);
|
---|
66 | saveButton = new JButton();
|
---|
67 | saveButton.setBounds(370, 430, 100, 20);
|
---|
68 | saveButton.setText(tr("Save"));
|
---|
69 | add(saveButton);
|
---|
70 | saveButton.addActionListener(alSave);
|
---|
71 |
|
---|
72 | }
|
---|
73 | }
|
---|