*
* @param c
* the component
- * @return
+ * @return The tab instance associated with the given component, or null if
+ * the tabsheet does not contain the component.
*/
public Tab getTab(Component c) {
return tabs.get(c);
* @param tab
*/
public void setSelectedTab(Tab tab) {
- setSelectedTab(tab.getComponent());
+ if (tab != null) {
+ setSelectedTab(tab.getComponent());
+ }
}
/**
- * Sets the selected tab, identified by its position. Does nothing if
- * <code>index < 0 || index > {@link #getComponentCount()}</code>.
+ * Sets the selected tab, identified by its position. Does nothing if the
+ * position is out of bounds.
*
- * @param index
+ * @param position
*/
- public void setSelectedTab(int index) {
- setSelectedTab(getTab(index));
+ public void setSelectedTab(int position) {
+ setSelectedTab(getTab(position));
}
/**