Changeset 34005 in osm for applications/editors/josm/plugins/indoorhelper/src/views/LevelSelectorView.java
- Timestamp:
- 2018-01-13T18:19:22+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/indoorhelper/src/views/LevelSelectorView.java
r33997 r34005 46 46 public class LevelSelectorView extends JFrame { 47 47 48 49 48 private static final long serialVersionUID = 1L; 49 private JPanel dialogPane; 50 50 private JPanel contentPanel; 51 51 private JPanel infoBar; … … 78 78 79 79 //======== dialogPane ======== 80 {81 dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));82 dialogPane.setLayout(new BorderLayout());83 80 81 dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12)); 82 dialogPane.setLayout(new BorderLayout()); 84 83 85 //======== infoBar ======== 86 { 84 //======== infoBar ======== 87 85 88 //---- Label1 ---- 89 label1.setText(tr("<html> Please insert the new level number you want to add.<br> " 90 + " <i>Info</i>: <br> If the OK button got pressed you will switch to the drawing action.<br>" 91 + "To finish the new object please press the spacebar. The new level<br>will be tagged automatically. </html>")); 92 infoBar.add(label1); 93 } 94 dialogPane.add(infoBar,BorderLayout.NORTH); 86 //---- Label1 ---- 87 label1.setText(tr("<html> Please insert the new level number you want to add.<br> " 88 + " <i>Info</i>: <br> If the OK button got pressed you will switch to the drawing action.<br>" 89 + "To finish the new object please press the spacebar. The new level<br>will be tagged automatically. </html>")); 90 infoBar.add(label1); 91 dialogPane.add(infoBar, BorderLayout.NORTH); 95 92 93 //======== contentPanel ======== 96 94 97 //======== contentPanel ======== 98 { 99 contentPanel.setLayout(new GridBagLayout()); 100 ((GridBagLayout) contentPanel.getLayout()).columnWidths = new int[] {0, 0, 0, 0, 0}; 101 ((GridBagLayout) contentPanel.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0}; 102 ((GridBagLayout) contentPanel.getLayout()).columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 1.0E-4}; 103 ((GridBagLayout) contentPanel.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4}; 95 contentPanel.setLayout(new GridBagLayout()); 96 ((GridBagLayout) contentPanel.getLayout()).columnWidths = new int[] {0, 0, 0, 0, 0}; 97 ((GridBagLayout) contentPanel.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0}; 98 ((GridBagLayout) contentPanel.getLayout()).columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 1.0E-4}; 99 ((GridBagLayout) contentPanel.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4}; 104 100 101 //---- Label2 ---- 102 label2.setText(tr("level number:")); 103 contentPanel.add(label2, new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, 104 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 105 new Insets(5, 5, 5, 30), 0, 0)); 105 106 106 //---- Label2 ---- 107 label2.setText(tr("level number:")); 108 contentPanel.add(label2,new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, 109 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 110 new Insets(5, 5, 5, 30), 0, 0)); 107 //---- Field ---- 108 field.setToolTipText(tr("Example: '2' or '3'")); 109 field.addFocusListener(new FocusListener() { 111 110 112 //---- Field ---- 113 field.setToolTipText(tr("Example: '2' or '3'")); 114 field.addFocusListener(new FocusListener() { 111 @Override 112 public void focusLost(FocusEvent e) {} 115 113 116 @Override 117 public void focusLost(FocusEvent e) {} 114 @Override 115 public void focusGained(FocusEvent e) { 116 field.selectAll(); 117 } 118 }); 119 contentPanel.add(field, new GridBagConstraints(3, 0, 2, 1, 0.0, 0.0, 120 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 121 new Insets(5, 0, 5, 200), 0, 0)); 118 122 119 @Override 120 public void focusGained(FocusEvent e) { 121 field.selectAll(); 122 } 123 }); 124 contentPanel.add(field, new GridBagConstraints(3, 0, 2, 1, 0.0, 0.0, 125 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 126 new Insets(5, 0, 5, 200), 0, 0)); 123 dialogPane.add(contentPanel, BorderLayout.CENTER); 127 124 128 } 129 dialogPane.add(contentPanel, BorderLayout.CENTER); 125 //======== buttonBar ======== 130 126 131 //======== buttonBar ======== 132 { 133 buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); 134 buttonBar.setLayout(new GridBagLayout()); 135 ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] {0, 85, 80}; 136 ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0, 0.0}; 127 buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); 128 buttonBar.setLayout(new GridBagLayout()); 129 ((GridBagLayout) buttonBar.getLayout()).columnWidths = new int[] {0, 85, 80}; 130 ((GridBagLayout) buttonBar.getLayout()).columnWeights = new double[] {1.0, 0.0, 0.0}; 137 131 138 139 140 141 142 132 //---- okButton ---- 133 okButton.setText(tr("OK")); 134 buttonBar.add(okButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, 135 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 136 new Insets(0, 0, 0, 5), 0, 0)); 143 137 144 145 146 147 148 149 } 150 151 } 138 //---- Button ---- 139 cancelButton.setText(tr("Cancel")); 140 buttonBar.add(cancelButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, 141 GridBagConstraints.CENTER, GridBagConstraints.BOTH, 142 new Insets(0, 0, 0, 0), 0, 0)); 143 144 dialogPane.add(buttonBar, BorderLayout.SOUTH); 145 152 146 contentPane.add(dialogPane, BorderLayout.CENTER); 153 147 pack(); 154 148 setLocationRelativeTo(getOwner()); 155 156 149 } 157 150 158 /*************************************************159 * GETTER160 *161 */162 151 /** 163 152 * Getter for the level number field. … … 169 158 } 170 159 171 /************************************************* 172 * SELECTOR VIEW LISTENER 173 * 174 */ 175 176 /** 160 /** 177 161 * Set the listener for the OK button. 178 162 * … … 183 167 } 184 168 185 169 /** 186 170 * Set the listener for the Cancel button. 187 171 * … … 198 182 */ 199 183 public void setSelectorWindowListener(WindowListener l) { 200 184 this.addWindowListener(l); 201 185 } 202 203 /**204 *205 *206 *207 *208 *209 *210 *211 *212 */213 186 }
Note:
See TracChangeset
for help on using the changeset viewer.