home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / plaf / basic / BasicEditorPaneUI.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.0 KB  |  83 lines

  1. package javax.swing.plaf.basic;
  2.  
  3. import java.beans.PropertyChangeEvent;
  4. import javax.swing.Action;
  5. import javax.swing.ActionMap;
  6. import javax.swing.JComponent;
  7. import javax.swing.JEditorPane;
  8. import javax.swing.plaf.ActionMapUIResource;
  9. import javax.swing.plaf.ComponentUI;
  10. import javax.swing.text.EditorKit;
  11. import javax.swing.text.JTextComponent;
  12.  
  13. public class BasicEditorPaneUI extends BasicTextUI {
  14.    public static ComponentUI createUI(JComponent var0) {
  15.       return new BasicEditorPaneUI();
  16.    }
  17.  
  18.    protected void installKeyboardActions() {
  19.       super.installKeyboardActions();
  20.       EditorKit var1 = this.getEditorKit(((BasicTextUI)this).getComponent());
  21.       if (var1 != null) {
  22.          Action[] var2 = var1.getActions();
  23.          if (var2 != null) {
  24.             this.addActions(((BasicTextUI)this).getComponent().getActionMap(), var2);
  25.          }
  26.       }
  27.  
  28.    }
  29.  
  30.    protected String getPropertyPrefix() {
  31.       return "EditorPane";
  32.    }
  33.  
  34.    public EditorKit getEditorKit(JTextComponent var1) {
  35.       JEditorPane var2 = (JEditorPane)((BasicTextUI)this).getComponent();
  36.       return var2.getEditorKit();
  37.    }
  38.  
  39.    ActionMap getActionMap() {
  40.       ActionMapUIResource var1 = new ActionMapUIResource();
  41.       ((ActionMap)var1).put("requestFocus", new BasicTextUI.FocusAction(this));
  42.       return var1;
  43.    }
  44.  
  45.    protected void propertyChange(PropertyChangeEvent var1) {
  46.       if (var1.getPropertyName().equals("editorKit")) {
  47.          ActionMap var2 = ((BasicTextUI)this).getComponent().getActionMap();
  48.          if (var2 != null) {
  49.             Object var3 = var1.getOldValue();
  50.             if (var3 instanceof EditorKit) {
  51.                Action[] var4 = ((EditorKit)var3).getActions();
  52.                if (var4 != null) {
  53.                   this.removeActions(var2, var4);
  54.                }
  55.             }
  56.  
  57.             Object var6 = var1.getNewValue();
  58.             if (var6 instanceof EditorKit) {
  59.                Action[] var5 = ((EditorKit)var6).getActions();
  60.                if (var5 != null) {
  61.                   this.addActions(var2, var5);
  62.                }
  63.             }
  64.          }
  65.       }
  66.  
  67.    }
  68.  
  69.    void removeActions(ActionMap var1, Action[] var2) {
  70.       for(Action var5 : var2) {
  71.          var1.remove(var5.getValue("Name"));
  72.       }
  73.  
  74.    }
  75.  
  76.    void addActions(ActionMap var1, Action[] var2) {
  77.       for(Action var5 : var2) {
  78.          var1.put(var5.getValue("Name"), var5);
  79.       }
  80.  
  81.    }
  82. }
  83.