home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.plaf.basic;
-
- import java.beans.PropertyChangeEvent;
- import javax.swing.Action;
- import javax.swing.ActionMap;
- import javax.swing.JComponent;
- import javax.swing.JEditorPane;
- import javax.swing.plaf.ActionMapUIResource;
- import javax.swing.plaf.ComponentUI;
- import javax.swing.text.EditorKit;
- import javax.swing.text.JTextComponent;
-
- public class BasicEditorPaneUI extends BasicTextUI {
- public static ComponentUI createUI(JComponent var0) {
- return new BasicEditorPaneUI();
- }
-
- protected void installKeyboardActions() {
- super.installKeyboardActions();
- EditorKit var1 = this.getEditorKit(((BasicTextUI)this).getComponent());
- if (var1 != null) {
- Action[] var2 = var1.getActions();
- if (var2 != null) {
- this.addActions(((BasicTextUI)this).getComponent().getActionMap(), var2);
- }
- }
-
- }
-
- protected String getPropertyPrefix() {
- return "EditorPane";
- }
-
- public EditorKit getEditorKit(JTextComponent var1) {
- JEditorPane var2 = (JEditorPane)((BasicTextUI)this).getComponent();
- return var2.getEditorKit();
- }
-
- ActionMap getActionMap() {
- ActionMapUIResource var1 = new ActionMapUIResource();
- ((ActionMap)var1).put("requestFocus", new BasicTextUI.FocusAction(this));
- return var1;
- }
-
- protected void propertyChange(PropertyChangeEvent var1) {
- if (var1.getPropertyName().equals("editorKit")) {
- ActionMap var2 = ((BasicTextUI)this).getComponent().getActionMap();
- if (var2 != null) {
- Object var3 = var1.getOldValue();
- if (var3 instanceof EditorKit) {
- Action[] var4 = ((EditorKit)var3).getActions();
- if (var4 != null) {
- this.removeActions(var2, var4);
- }
- }
-
- Object var6 = var1.getNewValue();
- if (var6 instanceof EditorKit) {
- Action[] var5 = ((EditorKit)var6).getActions();
- if (var5 != null) {
- this.addActions(var2, var5);
- }
- }
- }
- }
-
- }
-
- void removeActions(ActionMap var1, Action[] var2) {
- for(Action var5 : var2) {
- var1.remove(var5.getValue("Name"));
- }
-
- }
-
- void addActions(ActionMap var1, Action[] var2) {
- for(Action var5 : var2) {
- var1.put(var5.getValue("Name"), var5);
- }
-
- }
- }
-