source: osm/applications/editors/josm/plugins/smed2/src/panels/PanelMain.java@ 29215

Last change on this file since 29215 was 29215, checked in by malcolmh, 12 years ago

save

File size: 2.7 KB
Line 
1package panels;
2
3import static org.openstreetmap.josm.tools.I18n.tr;
4
5import java.awt.Color;
6import java.awt.Dimension;
7import java.awt.Rectangle;
8import java.awt.event.ActionListener;
9
10import javax.swing.*;
11
12import org.openstreetmap.josm.Main;
13
14import smed2.Smed2Action;
15
16public 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 importButton = null;
28 final JFileChooser ifc = new JFileChooser();
29 private ActionListener alImport = new ActionListener() {
30 public void actionPerformed(java.awt.event.ActionEvent e) {
31 if (e.getSource() == importButton) {
32 messageBar.setText("Select file");
33 int returnVal = ifc.showOpenDialog(Main.parent);
34 if (returnVal == JFileChooser.APPROVE_OPTION) {
35 Smed2Action.panelS57.startImport(ifc.getSelectedFile());
36 } else {
37 messageBar.setText("");
38 }
39 }
40 }
41 };
42
43 private JButton exportButton = null;
44 final JFileChooser efc = new JFileChooser();
45 private ActionListener alExport = new ActionListener() {
46 public void actionPerformed(java.awt.event.ActionEvent e) {
47 if (e.getSource() == exportButton) {
48 messageBar.setText("Select file");
49 int returnVal = efc.showOpenDialog(Main.parent);
50 if (returnVal == JFileChooser.APPROVE_OPTION) {
51 Smed2Action.panelS57.startExport(efc.getSelectedFile());
52 } else {
53 messageBar.setText("");
54 }
55 }
56 }
57 };
58
59 public PanelMain() {
60
61 setLayout(null);
62 setSize(new Dimension(480, 480));
63 tabs = new JTabbedPane(JTabbedPane.TOP);
64 tabs.setBounds(new Rectangle(0, 0, 480, 420));
65
66// JPanel panelF = new PanelF();
67// tabs.addTab(null, new ImageIcon(getClass().getResource("/images/tabF.png")), panelF, Messages.getString("Ports"));
68
69 add(tabs);
70
71 messageBar = new JTextField();
72 messageBar.setBounds(70, 430, 290, 20);
73 messageBar.setEditable(false);
74 messageBar.setBackground(Color.WHITE);
75 add(messageBar);
76 importButton = new JButton(new ImageIcon(getClass().getResource("/images/importButton.png")));
77 importButton.setBounds(10, 430, 20, 20);
78 add(importButton);
79 importButton.addActionListener(alImport);
80 exportButton = new JButton(new ImageIcon(getClass().getResource("/images/exportButton.png")));
81 exportButton.setBounds(40, 430, 20, 20);
82 add(exportButton);
83 exportButton.addActionListener(alExport);
84 saveButton = new JButton();
85 saveButton.setBounds(370, 430, 100, 20);
86 saveButton.setText(tr("Save"));
87 add(saveButton);
88 saveButton.addActionListener(alSave);
89
90 }
91}
Note: See TracBrowser for help on using the repository browser.