"Kämäräinen, Teemu"
Wed, 21 Apr 2004 23:29:13 -0700
Hi!
I noticed that the setNextFocusableComponent() method is deprecated
just after I had repost the message here -- the correct way to handle
focus traversal is via FocusTraversalPolicy-classes.
I made some tests based on your suggestion below. If I add the
following line of code into a SwiXml program:
System.out.println(((JFrame) se.find("frame"))
.getFocusTraversalPolicy().getClass().getName());
(the component with id "frame" is a frame, se is a SwingEngine
instance), "javax.swing.LayoutFocusTraversalPolicy" is printed.
So the default policy is the LayoutFocusTraversalPolicy. With
that policy the order of the component definitions in the XML
file doesn't count.
If I set the policy of the frame to be the
ContainerOrderFocusTraversalPolicy in the code, the order of the
components in the XML file counts. But, this policy gives the
focus to such components as vbox and scrollpane (without scrollbars)
also. Even setting the focusable attribute of these components to
false doesn't help. That's something I don't want to happen.
And then, how about Franklin -- will it be possible to arrange the
components in the XML file if using Franklin in the future?
BR, Teemu
--
TTM-Tieto Oy
Teemu Kämäräinen
GSM: +358 44 700 3227
E-mail: [EMAIL PROTECTED]
> -----Original Message-----
> From: Frank Meissner [mailto:[EMAIL PROTECTED]]
> Sent: 21. huhtikuuta 2004 20:33
> To: List for Users of Carlsbad Cubes' Technologies and Products
> Subject: Re: [Forum] FW: Using NextFocusableComponent attribute
>
>
> Hello Kämäräinen,
>
> another thought occured to me.
>
> The usual FocusTraversalPolicy of a container (I'm certain
> you have) is
> IMHO ContainerOrderFocusTraversalPolicy. This is quite useful in the
> ususal circumstances. That means, you have unusual ones ;)
>
> Perhaps you re-arrange the order your buttons occur in the
> XML? E.g. if
> you have GridBagLayout you can do a lot by using
> GridBagConstraints.gridx and the like. Or, if you *are* using these
> attributes right now, just change the order of the button-tags.
>
> Frank
>
> Kämäräinen, Teemu wrote:
> > This is a repost because I have got no reply for my question.
> >
> > -----Original Message-----
> > From: Kämäräinen, Teemu
> > Sent: 1. huhtikuuta 2004 11:01
> > To: 'forum@carlsbadcubes.com'
> > Subject: Using NextFocusableComponent attribute
> >
> >
> > Hi all!
> >
> > How should the NextFocusableComponent attribute be used?
> > I mean, in which form should a Component-typed attribute
> > be typed into the XML?
> >
> > Let's except e.g. we have three buttons, named "firstbutton",
> > "secondbutton" and "thirdbutton". By default the Tab-key
> > transfers the focus from "firstbutton" to "secondbutton",
> > but we would like the focus to move from "firstbutton" to
> > "thirdbutton". What kind of NextFocusableComponent attribute
> > definition should be added to the button tag defining
> > "firstbutton"?
> >
> > Thanks in advance.
> >
> >
> > --Teemu
> >
> > --
> > TTM-Tieto Oy
> > Teemu Kämäräinen
> >
> > GSM: +358 44 700 3227
> > E-mail: [EMAIL PROTECTED]
> >
> >
> >
> --------------------------------------------------------------
> ----------
> >
> > _______________________________________________
> > Forum mailing list
> > Forum@carlsbadcubes.com
> > http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
>
>
>
> _______________________________________________
> Forum mailing list
> Forum@carlsbadcubes.com
> http://carlsbadcubes.com/mailman/listinfo/forum_carlsbadcubes.com
>