Ejemplo n.º 1
0
  /* (non-Javadoc)
   * @see com.nullfish.app.jfd2.ui.container2.JFDContainer#setTitle(java.lang.String)
   */
  public void setTitle(final String titleText) {
    this.title = titleText;

    Runnable runnable =
        new Runnable() {
          public void run() {
            if (title.length() > MAX_TITLE_LENGTH) {
              StringBuffer buffer = new StringBuffer(title);
              buffer.replace(7, title.length() - MAX_TITLE_LENGTH + 3 + 7, "...");
              title = buffer.toString();
            }

            int index = tabbedPane.indexOfComponent(TabContainer.this);
            if (index >= 0) {
              tabbedPane.setTitleAt(index, title);
            }
          }
        };

    ThreadSafeUtilities.executeRunnable(runnable);
  }
Ejemplo n.º 2
0
  /* (non-Javadoc)
   * @see com.nullfish.app.jfd2.ui.container2.JFDContainer#requestContainerFocus()
   */
  public void requestContainerFocus() {
    Runnable runnable =
        new Runnable() {
          public void run() {
            Component component = tabbedPane.getSelectedComponent();

            tabbedPane.setSelectedComponent(TabContainer.this);
            TabContainer.this.setVisible(true);

            if (component != null) {
              ((TabContainer) component).getComponent().getComponent().requestFocusInWindow();
            }

            getComponent().getComponent().requestFocusInWindow();

            Window window = SwingUtilities.getWindowAncestor(TabContainer.this);
            if (!window.isActive()) {
              window.toFront();
            }
          }
        };

    ThreadSafeUtilities.executeRunnable(runnable);
  }