source: osm/applications/editors/josm/plugins/indoorhelper/src/views/FittingView.java@ 32122

Last change on this file since 32122 was 32122, checked in by erigrus, 8 years ago

initial commit

File size: 3.1 KB
Line 
1/*
2 * Indoorhelper is a JOSM plug-in to support users when creating their own indoor maps.
3 * Copyright (C) 2016 Erik Gruschka
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package views;
20
21import static org.openstreetmap.josm.tools.I18n.tr;
22
23import java.awt.*;
24import java.awt.event.ActionListener;
25
26import javax.swing.*;
27import javax.swing.border.*;
28
29
30/**
31 * The view for the pop-up hint that tells the user, that he has to start the fitting
32 * of his indoor building plans.
33 *
34 * @author egru
35 */
36@SuppressWarnings("serial")
37public class FittingView extends JFrame {
38
39 private JPanel dialogPane;
40 private JPanel contentPanel;
41 private JLabel label1;
42 private JPanel buttonBar;
43 private JButton okButton;
44
45 public FittingView() {
46 initComponents();
47 }
48
49 private void initComponents() {
50 dialogPane = new JPanel();
51 contentPanel = new JPanel();
52 label1 = new JLabel();
53 buttonBar = new JPanel();
54 okButton = new JButton();
55
56 //======== this ========
57 setTitle(tr("Fitting"));
58 Container contentPane = getContentPane();
59 contentPane.setLayout(new BorderLayout());
60
61 //======== dialogPane ========
62 {
63 dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));
64 dialogPane.setLayout(new BorderLayout());
65
66 //======== contentPanel ========
67 {
68 contentPanel.setLayout(new FlowLayout());
69
70 //---- label1 ----
71 label1.setText(tr("<html>Please mind to start fitting your building-plans now.<br>" +
72 "To do so, use the PicLayer plug-in, which you can install<br>" +
73 "using the JOSM plug-in management.</html>"));
74 contentPanel.add(label1);
75 }
76 dialogPane.add(contentPanel, BorderLayout.CENTER);
77
78 //======== buttonBar ========
79 {
80 buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0));
81 buttonBar.setLayout(new GridBagLayout());
82 ((GridBagLayout)buttonBar.getLayout()).columnWidths = new int[] {0, 80};
83 ((GridBagLayout)buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0};
84
85 //---- okButton ----
86 okButton.setText(tr("OK"));
87 buttonBar.add(okButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
88 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
89 new Insets(0, 0, 0, 0), 0, 0));
90 }
91 dialogPane.add(buttonBar, BorderLayout.SOUTH);
92 }
93 contentPane.add(dialogPane, BorderLayout.CENTER);
94 pack();
95 setLocationRelativeTo(getOwner());
96 }
97
98 /**
99 * Set the given {@link ActionListener} to the OK-Button of the {@link FittingView}.
100 *
101 * @param l the listener which should be set
102 */
103 public void setOkButtonListener(ActionListener l){
104 this.okButton.addActionListener(l);
105 }
106}
Note: See TracBrowser for help on using the repository browser.