[gui] Some (random) AWT and Swing fixlets

Thomas Fitzsimmons fitzsim@redhat.com
Sun Feb 13 21:39:00 GMT 2005


Hi,

> -   * @return the specified keystroke
> -   * @throws NullPointerException if s is null
> -   * @throws IllegalArgumentException if s cannot be parsed
> +   * @return the specified keystroke, or null when s is null
> +   * or cannot be parsed correctly.

The javadocs disagree with this change.

> +  /**
> +   * Returns the viewSize when set, or the size of the set Component
> view.
> +   * If no viewSize and no Component view is set an empty Dimension
> is
> +   * returned.
> +   */
>    public Dimension getViewSize()
>    {
>      if (isViewSizeSet)
>        return viewSize;
>      else
> -      return getView().getSize();
> +      {
> +       Component view = getView();
> +       if (view != null)
> +         return view.getSize();

According to the javadocs, you should be returning the preferred size
here.

The other changes are fine.

Tom




More information about the Java-patches mailing list