/** Set the label text. */ private void setLabelText() { if (!active) { return; } StringBuffer buf = new StringBuffer(); buf.append(" "); buf.append(getRangeName()); buf.append(": "); buf.append(StringUtil.padLeft(rangeReadout.getNumericString(), 6)); buf.append(" "); buf.append(getBearingName()); buf.append(": "); buf.append(StringUtil.padLeft(bearingReadout.getNumericString(), 6)); String text = buf.toString(); valueDisplay.setText(text); if (myOwnLabel) { FontMetrics fm = valueDisplay.getFontMetrics(valueDisplay.getFont()); valueDisplay.setPreferredSize(new Dimension(fm.stringWidth(text), fm.getHeight())); } }
/** * Return a String representation of this * * @return a String representation of this */ public String toString() { StringBuilder builder = new StringBuilder(); builder.append(StringUtil.padRight((stid.trim() + std2.trim()), 8)); builder.append(" "); builder.append(Format.i(stnm, 6)); builder.append(" "); builder.append(StringUtil.padRight(sdesc, 32)); builder.append(" "); builder.append(StringUtil.padLeft(stat.trim(), 2)); builder.append(" "); builder.append(StringUtil.padLeft(coun.trim(), 2)); builder.append(" "); builder.append(Format.i(slat, 5)); builder.append(" "); builder.append(Format.i(slon, 6)); builder.append(" "); builder.append(Format.i(selv, 5)); builder.append(" "); builder.append(Format.i(spri, 2)); builder.append(" "); builder.append(StringUtil.padLeft(swfo.trim(), 3)); return builder.toString(); }