8. JTabbedPaneUpdater update() method.

Listing 8. JTabbedPaneUpdater update() method.


public void update(Object target, String key)
{
  Assert.pre(target instanceof JTabbedPane,
     "Parameter target instanceof JTabbedPane");
  Assert.pre(key != null, 
                 "Parameter key is not null");

  JTabbedPane pane = (JTabbedPane)target;

  for (int i = 0; i < pane.getTabCount(); i++)
  {
    try
    {
      String tabTitle = resource.getTitle(key+i);
      pane.setTitleAt(i, tabTitle);
    }
    catch (Exception e)
    {
      Assert.assert(false,
        "Exception does not occur for tab " + i + 
        "\n" + e);
    }
    }
}