Changeset 2137 in josm
- Timestamp:
- 2009-09-14T21:57:36+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r2127 r2137 34 34 import javax.swing.JLabel; 35 35 import javax.swing.JPanel; 36 import javax.swing.JScrollPane; 36 37 import javax.swing.JTextField; 37 38 import javax.swing.Popup; … … 194 195 } 195 196 196 JPanel c = new JPanel(new GridBagLayout()); 197 c.setBorder(BorderFactory.createRaisedBevelBorder()); 197 final JPanel c = new JPanel(new GridBagLayout()); 198 198 final JLabel lbl = new JLabel( 199 199 "<html>"+tr("Middle click again, to cycle through.<br>"+ … … 240 240 /** 241 241 * Creates a popup for the given content next to the cursor. Tries to 242 * keep the popup on screen. 242 * keep the popup on screen and shows a vertical scrollbar, if the 243 * screen is too small. 243 244 * @param content 244 245 * @param ms … … 257 258 } 258 259 int yPos = p.y + ms.mousePos.y + 16; 259 // Move the popup up if it would be cut off at its bottom 260 // Move the popup up if it would be cut off at its bottom but do not 261 // move it off screen on the top 260 262 if(yPos + dim.height > scrn.height - 5) { 261 yPos = scrn.height - dim.height - 5; 262 } 263 yPos = Math.max(5, scrn.height - dim.height - 5); 264 } 265 266 // Create a JScrollPane around the content, in case there's still 267 // not enough space 268 JScrollPane sp = new JScrollPane(content); 269 sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); 270 sp.setBorder(BorderFactory.createRaisedBevelBorder()); 271 // Implement max-size content-independent 272 Dimension prefsize = sp.getPreferredSize(); 273 int w = Math.min(prefsize.width, scrn.width/2); 274 int h = Math.min(prefsize.height, scrn.height - 10); 275 sp.setPreferredSize(new Dimension(w, h)); 263 276 264 277 PopupFactory pf = PopupFactory.getSharedInstance(); 265 return pf.getPopup(mv, content, xPos, yPos);278 return pf.getPopup(mv, sp, xPos, yPos); 266 279 } 267 280 … … 394 407 String name = osm.getDisplayName(DefaultNameFormatter.getInstance()); 395 408 if (osm.getId() == 0 || osm.isModified()) { 396 name = "<i><b>"+ osm.getDisplayName(DefaultNameFormatter.getInstance())+"*</b></i>";409 name = "<i><b>"+ name + "*</b></i>"; 397 410 } 398 411 text.append(name); 412 399 413 if (osm.getId() != 0) { 400 text.append("<br>id="+osm.getId()); 401 } 414 text.append(" [id="+osm.getId()+"]"); 415 } 416 417 if(osm.user != null) { 418 text.append(" [" + tr("User:") + " " + osm.user.getName() + "]"); 419 } 420 402 421 for (Entry<String, String> e1 : osm.entrySet()) { 403 text.append("<br>" +e1.getKey()+"="+e1.getValue());422 text.append("<br>" + e1.getKey() + "=" + e1.getValue()); 404 423 } 405 424 406 425 final JLabel l = new JLabel( 407 "<html>" +text.toString()+"</html>",426 "<html>" +text.toString() + "</html>", 408 427 ImageProvider.get(OsmPrimitiveType.from(osm)), 409 428 JLabel.HORIZONTAL
Note:
See TracChangeset
for help on using the changeset viewer.