/[classpath]/classpath/javax/swing/plaf/basic/BasicTextUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicTextUI.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.55 by rabbit78, Mon Nov 14 12:10:35 2005 UTC revision 1.56 by rabbit78, Tue Nov 15 20:32:46 2005 UTC
# Line 58  import javax.swing.JComponent; Line 58  import javax.swing.JComponent;
58  import javax.swing.LookAndFeel;  import javax.swing.LookAndFeel;
59  import javax.swing.SwingConstants;  import javax.swing.SwingConstants;
60  import javax.swing.SwingUtilities;  import javax.swing.SwingUtilities;
 import javax.swing.UIDefaults;  
61  import javax.swing.UIManager;  import javax.swing.UIManager;
62  import javax.swing.event.DocumentEvent;  import javax.swing.event.DocumentEvent;
63  import javax.swing.event.DocumentListener;  import javax.swing.event.DocumentListener;
# Line 618  public abstract class BasicTextUI extend Line 617  public abstract class BasicTextUI extend
617    protected Keymap createKeymap()    protected Keymap createKeymap()
618    {    {
619      String prefix = getPropertyPrefix();      String prefix = getPropertyPrefix();
     UIDefaults defaults = UIManager.getLookAndFeelDefaults();  
620      JTextComponent.KeyBinding[] bindings =      JTextComponent.KeyBinding[] bindings =
621        (JTextComponent.KeyBinding[]) defaults.get(prefix + ".keyBindings");        (JTextComponent.KeyBinding[]) UIManager.get(prefix + ".keyBindings");
622      if (bindings == null)      if (bindings == null)
623        {        {
624          bindings = new JTextComponent.KeyBinding[0];          bindings = new JTextComponent.KeyBinding[0];
625          defaults.put(prefix + ".keyBindings", bindings);          // FIXME: Putting something into the defaults map is certainly wrong.
626            // Must be fixed somehow.
627            UIManager.put(prefix + ".keyBindings", bindings);
628        }        }
629    
630      Keymap km = JTextComponent.addKeymap(getKeymapName(),      Keymap km = JTextComponent.addKeymap(getKeymapName(),
# Line 661  public abstract class BasicTextUI extend Line 661  public abstract class BasicTextUI extend
661    InputMap getInputMap(int condition)    InputMap getInputMap(int condition)
662    {    {
663      String prefix = getPropertyPrefix();      String prefix = getPropertyPrefix();
     UIDefaults defaults = UIManager.getLookAndFeelDefaults();  
664      switch (condition)      switch (condition)
665        {        {
666        case JComponent.WHEN_IN_FOCUSED_WINDOW:        case JComponent.WHEN_IN_FOCUSED_WINDOW:
667          // FIXME: is this the right string? nobody seems to use it.          // FIXME: is this the right string? nobody seems to use it.
668          return (InputMap) defaults.get(prefix + ".windowInputMap");          return (InputMap) UIManager.get(prefix + ".windowInputMap");
669        case JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT:        case JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT:
670          return (InputMap) defaults.get(prefix + ".ancestorInputMap");          return (InputMap) UIManager.get(prefix + ".ancestorInputMap");
671        default:        default:
672        case JComponent.WHEN_FOCUSED:        case JComponent.WHEN_FOCUSED:
673          return (InputMap) defaults.get(prefix + ".focusInputMap");          return (InputMap) UIManager.get(prefix + ".focusInputMap");
674        }        }
675    }    }
676    
# Line 685  public abstract class BasicTextUI extend Line 684  public abstract class BasicTextUI extend
684    ActionMap getActionMap()    ActionMap getActionMap()
685    {    {
686      String prefix = getPropertyPrefix();      String prefix = getPropertyPrefix();
687      UIDefaults defaults = UIManager.getLookAndFeelDefaults();          ActionMap am = (ActionMap) UIManager.get(prefix + ".actionMap");
     ActionMap am = (ActionMap) defaults.get(prefix + ".actionMap");  
688      if (am == null)      if (am == null)
689        {        {
690          am = createActionMap();          am = createActionMap();
691          defaults.put(prefix + ".actionMap", am);          // FIXME: Putting something in the UIDefaults map is certainly wrong.
692            // However, the whole method seems wrong and must be replaced by
693            // something that is less wrong.
694            UIManager.put(prefix + ".actionMap", am);
695        }        }
696      return am;      return am;
697    }    }

Legend:
Removed from v.1.55  
changed lines
  Added in v.1.56

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26