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