0

There is a Tabs component which has two tab :

private Tabs tabClient = new Tabs();
...
tabClient.addTab("Fiche", cFicheClient); // cFicheClient is a Container
tabClient.addTab("Crédits", cClientEtCredits); // cClientEtCredits is a Container
tabClient.addTabsFocusListener(this);

public void focusGained(Component arg0) {
        String noms = Formatage.getColumnValueAt(String.valueOf(fichesignalitique.elementAt(0)).toUpperCase(), 11);
        if (tabClient.getSelectedIndex() == 0)
        {
            setTitle("Fiche signalétique de " + noms);
            photosBtn.requestFocus();
        }
        else
        {
            setTitle("Liste des crédits de " + noms);
            recapClient.requestFocus();
        }
        repaint();
    }

In runtime I cannot click the "Crédits" tab : the Tabs doesn't show the components of the cClientEtCredits Container ! And also the Form's title is not displayed when the Form is shown but I must click one tab button in order to show the Form's title !

So why ?

Mun0n
  • 4,438
  • 4
  • 28
  • 46
  • This is just a snippet, need to provide more code to analyze the reason for container `cClientEtCredits` not being shown. Also need relevant code for form title container manipulation in the your code. – Vimal Dec 19 '11 at 16:05

1 Answers1

1

I'm guessing its because of the request focus call within a focus listener.

You should probably change the tab selection before moving the focus to a different component by using something like setSelectedIndex.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65