/** * Returns the editted value. * * @return the editted value. * @throws TagFormatException if the tag value cannot be retrieved with the expected type. */ public TagValue getTagValue() throws TagFormatException { try { long numer = Long.parseLong(m_numer.getText()); long denom = Long.parseLong(m_denom.getText()); Rational rational = new Rational(numer, denom); return new TagValue(m_value.getTag(), rational); } catch (NumberFormatException e) { e.printStackTrace(); throw new TagFormatException( m_numer.getText() + "/" + m_denom.getText() + " is not a valid rational"); } }
/** * Sets the height of the table cell in which this is displayed * * @param h cell height */ public void setHeight(int h) { setSize(getWidth(), h); m_numer.setSize(m_numer.getWidth(), h); m_divider.setSize(m_divider.getWidth(), h); m_denom.setSize(m_denom.getWidth(), h); }
/** * Returns the editted value as a string. * * @return the editted value as a string. */ public String getAsString() { return m_numer.getText() + "/" + m_denom.getText(); }