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);
    }
    }
}

Featured

Most   Popular
Upcoming Events

AppTrends

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.