Metodo de mudança do JTabbedPane

2 respostas
K

AE,Existe uma maneira de quando apertar um botão fazer o JTabbedPane passar para outra Aba, altomaticamente???

tem um metodo que mostra quando a aba foi mudada

tb.addChangeListener(new ChangeListener(){
				public void stateChanged(ChangeEvent evt){

mas tem algum semelhante que mude a aba da 0 para 1 por exemplo como um foco???

Obrigado!!

2 Respostas

leonardom

Vc já tentou usar o método setSelectedIndex(int index) ?

setSelectedIndex
public void setSelectedIndex(int index)
Sets the selected index for this tabbedpane. The index must be a valid tab index or -1, which indicates that no tab should be selected (can also be used when there are no tabs in the tabbedpane). If a -1 value is specified when the tabbedpane contains one or more tabs, then the results will be implementation defined.

Parameters:

index - the index to be selected

Throws:

IndexOutOfBoundsException - if index is out of range (index < -1 || index >= tab count)

See Also:

getSelectedIndex(), SingleSelectionModel.setSelectedIndex(int)
K

Valeu!!
bah mais simples impossivel.Malz ae :x

Criado 5 de agosto de 2004
Ultima resposta 5 de ago. de 2004
Respostas 2
Participantes 2