How to change the tab of a jTabbedPane when action performed

The scenario is like this : I have a jTabbedPane with 2 tabs. I want, when an action is performed in one tab (for example a button is clicked on tab1) to change the tab automatically (to make tab2 visible). How can i do this?Thank you in advance
[259 byte] By [Opaquea] at [2007-11-27 6:46:42]
# 1
read the API: http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTabbedPane.htmlFor setting things, check out methods that begin with "set"
Nethera at 2007-7-12 18:19:07 > top of Java-index,Desktop,Core GUI APIs...
# 2
I've read JTabbedPane API before i post the message, but unfortunately i couldn't find a solution to my problem. I tried to use the methods grabFocus and requestFocus to change the focus of the application, but it didn't work.Thank you for replying Nether.
Opaquea at 2007-7-12 18:19:07 > top of Java-index,Desktop,Core GUI APIs...
# 3
o well, at least you looked....setSelectedIndex(int)
Nethera at 2007-7-12 18:19:07 > top of Java-index,Desktop,Core GUI APIs...
# 4
Nether, i don't know what to say, i'm inexcusable. I really looked, but i guess i missed this function!!!Anyway, thanks again....
Opaquea at 2007-7-12 18:19:07 > top of Java-index,Desktop,Core GUI APIs...