Changeset 19048 in josm for trunk/src/org/openstreetmap/josm/gui/widgets/JosmTextField.java
- Timestamp:
- 2024-04-19T16:21:11+02:00 (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/widgets/JosmTextField.java
r18538 r19048 5 5 import java.awt.ComponentOrientation; 6 6 import java.awt.Font; 7 import java.awt.FontMetrics;8 7 import java.awt.Graphics; 9 8 import java.awt.Graphics2D; … … 19 18 20 19 import javax.swing.Icon; 20 import javax.swing.JMenuItem; 21 import javax.swing.JPopupMenu; 21 22 import javax.swing.JTextField; 22 23 import javax.swing.RepaintManager; 23 import javax.swing.JMenuItem;24 import javax.swing.JPopupMenu;25 24 import javax.swing.UIManager; 26 25 import javax.swing.text.BadLocationException; … … 30 29 import org.openstreetmap.josm.gui.MapFrame; 31 30 import org.openstreetmap.josm.tools.Destroyable; 31 import org.openstreetmap.josm.tools.Logging; 32 32 import org.openstreetmap.josm.tools.Utils; 33 33 … … 254 254 */ 255 255 public static Color getHintTextColor() { 256 Color color = UIManager.getColor("TextField[Disabled].textForeground"); // Nimbus?256 var color = UIManager.getColor("TextField[Disabled].textForeground"); // Nimbus? 257 257 if (color == null) 258 258 color = UIManager.getColor("TextField.inactiveForeground"); … … 290 290 int x; 291 291 try { 292 x = modelToView(0).x;292 x = (int) Math.round(modelToView2D(0).getX()); 293 293 } catch (BadLocationException exc) { 294 Logging.trace(exc); 294 295 return; // can't happen 295 296 } … … 304 305 g.drawString(getHint(), x, getBaseline(getWidth(), getHeight())); 305 306 } else { 306 FontMetricsmetrics = g.getFontMetrics(g.getFont());307 final var metrics = g.getFontMetrics(g.getFont()); 307 308 int dx = metrics.stringWidth(getHint()); 308 309 g.drawString(getHint(), x - dx, getBaseline(getWidth(), getHeight()));
Note:
See TracChangeset
for help on using the changeset viewer.