1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-01 12:24:14 +01:00

Show port on status bar only when selected

This commit is contained in:
Cristian Maglie 2018-11-09 12:41:48 +01:00 committed by Cristian Maglie
parent cede26883e
commit fd1b598ea2

View File

@ -110,11 +110,17 @@ public class EditorLineStatus extends JComponent {
g.drawString(text, scale(6), baseline); g.drawString(text, scale(6), baseline);
g.setColor(messageForeground); g.setColor(messageForeground);
String tmp = I18n.format(tr("{0} on {1}"), name, serialport);
Rectangle2D bounds = g.getFontMetrics().getStringBounds(tmp, null); String statusText;
if (serialport != null && !serialport.isEmpty()) {
statusText = I18n.format(tr("{0} on {1}"), name, serialport);
} else {
statusText = name;
}
g.drawString(tmp, size.width - (int) bounds.getWidth() - RESIZE_IMAGE_SIZE, Rectangle2D bounds = g.getFontMetrics().getStringBounds(statusText, null);
g.drawString(statusText, size.width - (int) bounds.getWidth() - RESIZE_IMAGE_SIZE,
baseline); baseline);
if (OSUtils.isMacOS()) { if (OSUtils.isMacOS()) {