JViewPort doesn't work with shit+tab

I have a JScrollPane and I've added several components into it from top to bottom, according the layout manager I'm using.

I've also implemented the FocusListener interface, so when one of those components is focused, I execute a method that should keep the component always visible.

publicvoid focusGained(FocusEvent e)

{

Component comp = e.getComponent();

Rectangle rectComp = comp.getBounds();

JViewport jViewPort = jScrollPane1.getViewport();

jViewPort.scrollRectToVisible(rectComp);

}

Actually this piece of code works fine only if I press the TAB key: the JScrollPane object scrolls down and it's ok;

But when I press SHIFT+TAB and the focus goes to the previous component, the JViewPort does nothing and the focused component keeps hidden: the JScrollPane should scroll up.

What is happening ?

Thanks in advance.

-- Lelio.

[1058 byte] By [leliojr] at [2007-9-26 2:30:09]
# 1

Hi Leilo

Er... would you care to re-write the title of this topic?!

Remember "shift" has FIVE letters ;)

In regards to your question: I'm sorry I don't have the answer but I'm sure somebody does. Hopefully they'll see the post.

Regards

Daniel Lam

Daniel_Lam at 2007-6-29 9:48:34 > top of Java-index,Archived Forums,Swing...