Changeset 32637 in osm for applications/editors/josm/plugins/indoorhelper/src/views/FittingView.java
- Timestamp:
- 2016-07-11T22:48:15+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/indoorhelper/src/views/FittingView.java
r32122 r32637 21 21 import static org.openstreetmap.josm.tools.I18n.tr; 22 22 23 import java.awt.*; 23 import java.awt.BorderLayout; 24 import java.awt.Container; 25 import java.awt.FlowLayout; 26 import java.awt.GridBagConstraints; 27 import java.awt.GridBagLayout; 28 import java.awt.Insets; 24 29 import java.awt.event.ActionListener; 25 30 26 import javax.swing.*; 27 import javax.swing.border.*; 31 import javax.swing.JButton; 32 import javax.swing.JFrame; 33 import javax.swing.JLabel; 34 import javax.swing.JPanel; 35 import javax.swing.border.EmptyBorder; 28 36 29 37 … … 31 39 * The view for the pop-up hint that tells the user, that he has to start the fitting 32 40 * of his indoor building plans. 33 * 41 * 34 42 * @author egru 35 43 */ 36 44 @SuppressWarnings("serial") 37 45 public 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 46 49 private void initComponents() { 50 dialogPane = new JPanel(); 51 contentPanel = new JPanel(); 52 label1 = new JLabel(); 53 buttonBar = new JPanel(); 54 okButton = new JButton(); 47 private JPanel dialogPane; 48 private JPanel contentPanel; 49 private JLabel label1; 50 private JPanel buttonBar; 51 private JButton okButton; 55 52 56 //======== this ======== 57 setTitle(tr("Fitting")); 58 Container contentPane = getContentPane(); 59 contentPane.setLayout(new BorderLayout()); 53 public FittingView() { 54 initComponents(); 55 } 60 56 61 //======== dialogPane ======== 62 { 63 dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); 64 dialogPane.setLayout(new BorderLayout()); 57 private void initComponents() { 58 dialogPane = new JPanel(); 59 contentPanel = new JPanel(); 60 label1 = new JLabel(); 61 buttonBar = new JPanel(); 62 okButton = new JButton(); 65 63 66 //======== contentPanel ======== 67 { 68 contentPanel.setLayout(new FlowLayout()); 64 //======== this ======== 65 setTitle(tr("Fitting")); 66 Container contentPane = getContentPane(); 67 contentPane.setLayout(new BorderLayout()); 69 68 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); 69 //======== dialogPane ======== 70 { 71 dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); 72 dialogPane.setLayout(new BorderLayout()); 77 73 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}; 74 //======== contentPanel ======== 75 { 76 contentPanel.setLayout(new FlowLayout()); 84 77 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 } 78 //---- label1 ---- 79 label1.setText(tr("<html>Please mind to start fitting your building-plans now.<br>" + 80 "To do so, use the PicLayer plug-in, which you can install<br>" + 81 "using the JOSM plug-in management.</html>")); 82 contentPanel.add(label1); 83 } 84 dialogPane.add(contentPanel, BorderLayout.CENTER); 85 86 //======== buttonBar ======== 87 { 88 buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); 89 buttonBar.setLayout(new GridBagLayout()); 90 ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] {0, 80}; 91 ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0}; 92 93 //---- okButton ---- 94 okButton.setText(tr("OK")); 95 buttonBar.add(okButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, 96 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 97 new Insets(0, 0, 0, 0), 0, 0)); 98 } 99 dialogPane.add(buttonBar, BorderLayout.SOUTH); 100 } 101 contentPane.add(dialogPane, BorderLayout.CENTER); 102 pack(); 103 setLocationRelativeTo(getOwner()); 104 } 105 106 /** 107 * Set the given {@link ActionListener} to the OK-Button of the {@link FittingView}. 108 * 109 * @param l the listener which should be set 110 */ 111 public void setOkButtonListener(ActionListener l) { 112 this.okButton.addActionListener(l); 113 } 106 114 }
Note:
See TracChangeset
for help on using the changeset viewer.
