classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] Patch: Text components home and end actions


From: Lillian Angel
Subject: Re: [cp-patches] Patch: Text components home and end actions
Date: Wed, 21 Dec 2005 09:31:36 -0500

Hi Roman, 

> 
> I would prefer the more efficient (and more correct?) solution and fix
> the viewToModel() methods. I don't really care if it doesn't work yet
> because of the viewToModel() methods not working properly, this way we
> have some more reasons to fix those.

Its not necessarily *more* correct, but right now we are using a loop to
get to the first/last character of that line. It only goes through this
loop when HOME/END is pressed. So, it is not too inefficient since the
loop is only executed one time per HOME/END key press. Obviously, we can
change this to something better by adding a few calls to viewToModel,
but it does not seem crucial; thus the reason for adding the TODO so it
can be looked at again later when text is working better.


> 
> Also, in JTextComponent you directly create KeyBindings for the new
> Actions. 

This is done for *all* the key bindings right now. Not just the ones I
have added.

> This doesn't sound right, IMO this should be done by the UI
> (BasicTextUI). 

I agree there has to be a better way to create all the default key
bindings for text.

> The UIDefaults should have an array of InputMap-like
> bindings (e.g. in TextField.focusInputMap) that should then be loaded
> into an InputMap (using LookAndFeel.loadKeyBindings()) and installed in
> the text component (using SwingUtilities.replaceUIInputMap()). Direct
> key bindings are not what we want.

I agree. I will look into fixing all the key bindings created right now.

> Also note
> that there is a getActionMap() method in BasicTextUI that really
> shouldn't be there. We should figure out how to properly install an
> ActionMap on the text component, I would think that we fetch
> getActions() from JTextComponent and create an ActionMap out of it by
> fetching the NAME from the Action instances and put them into an
> ActionMap using the NAME as key.

Okay, no problem.

Lillian





reply via email to

[Prev in Thread] Current Thread [Next in Thread]