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 JTabbedPane tabs = null;
|
---|
19 | // public PanelF panelF = null;
|
---|
20 | public static JTextField messageBar = null;
|
---|
21 | public JButton saveButton = null;
|
---|
22 | private ActionListener alSave = new ActionListener() {
|
---|
23 | public void actionPerformed(java.awt.event.ActionEvent e) {
|
---|
24 | // item.saveSign(???);
|
---|
25 | }
|
---|
26 | };
|
---|
27 | private JButton openButton = null;
|
---|
28 | final JFileChooser fc = new JFileChooser();
|
---|
29 | private ActionListener alOpen = new ActionListener() {
|
---|
30 | public void actionPerformed(java.awt.event.ActionEvent e) {
|
---|
31 | if (e.getSource() == openButton) {
|
---|
32 | messageBar.setText("Select file");
|
---|
33 | int returnVal = fc.showOpenDialog(Main.parent);
|
---|
34 | if (returnVal == JFileChooser.APPROVE_OPTION) {
|
---|
35 | Smed2Action.panelS57.startImport(fc.getSelectedFile());
|
---|
36 | } else {
|
---|
37 | messageBar.setText("");
|
---|
38 | }
|
---|
39 | }
|
---|
40 | }
|
---|
41 | };
|
---|
42 |
|
---|
43 | public PanelMain() {
|
---|
44 |
|
---|
45 | setLayout(null);
|
---|
46 | setSize(new Dimension(480, 480));
|
---|
47 | tabs = new JTabbedPane(JTabbedPane.TOP);
|
---|
48 | tabs.setBounds(new Rectangle(0, 0, 480, 420));
|
---|
49 |
|
---|
50 | // JPanel panelF = new PanelF();
|
---|
51 | // tabs.addTab(null, new ImageIcon(getClass().getResource("/images/tabF.png")), panelF, Messages.getString("Ports"));
|
---|
52 |
|
---|
53 | add(tabs);
|
---|
54 |
|
---|
55 | messageBar = new JTextField();
|
---|
56 | messageBar.setBounds(40, 430, 320, 20);
|
---|
57 | messageBar.setEditable(false);
|
---|
58 | messageBar.setBackground(Color.WHITE);
|
---|
59 | add(messageBar);
|
---|
60 | openButton = new JButton(new ImageIcon(getClass().getResource("/images/fileButton.png")));
|
---|
61 | openButton.setBounds(10, 430, 20, 20);
|
---|
62 | add(openButton);
|
---|
63 | openButton.addActionListener(alOpen);
|
---|
64 | saveButton = new JButton();
|
---|
65 | saveButton.setBounds(370, 430, 100, 20);
|
---|
66 | saveButton.setText(tr("Save"));
|
---|
67 | add(saveButton);
|
---|
68 | saveButton.addActionListener(alSave);
|
---|
69 |
|
---|
70 | }
|
---|
71 | }
|
---|