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 / text / StyledEditorKit$AttributeTracker.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.7 KB  |  52 lines

  1. package javax.swing.text;
  2.  
  3. import java.beans.PropertyChangeEvent;
  4. import java.beans.PropertyChangeListener;
  5. import java.io.Serializable;
  6. import java.util.EventObject;
  7. import javax.swing.event.CaretEvent;
  8. import javax.swing.event.CaretListener;
  9.  
  10. class StyledEditorKit$AttributeTracker implements CaretListener, PropertyChangeListener, Serializable {
  11.    // $FF: synthetic field
  12.    private final StyledEditorKit this$0;
  13.  
  14.    StyledEditorKit$AttributeTracker(StyledEditorKit var1) {
  15.       this.this$0 = var1;
  16.    }
  17.  
  18.    void updateInputAttributes(int var1, int var2, JTextComponent var3) {
  19.       Document var4 = var3.getDocument();
  20.       if (var4 instanceof StyledDocument) {
  21.          int var5 = Math.min(var1, var2);
  22.          StyledDocument var6 = (StyledDocument)var4;
  23.          this.this$0.currentParagraph = var6.getParagraphElement(var5);
  24.          Element var7;
  25.          if (this.this$0.currentParagraph.getStartOffset() != var5 && var1 == var2) {
  26.             var7 = var6.getCharacterElement(Math.max(var5 - 1, 0));
  27.          } else {
  28.             var7 = var6.getCharacterElement(var5);
  29.          }
  30.  
  31.          if (var7 != this.this$0.currentRun) {
  32.             this.this$0.currentRun = var7;
  33.             this.this$0.createInputAttributes(this.this$0.currentRun, this.this$0.getInputAttributes());
  34.          }
  35.  
  36.       }
  37.    }
  38.  
  39.    public void propertyChange(PropertyChangeEvent var1) {
  40.       Object var2 = var1.getNewValue();
  41.       Object var3 = ((EventObject)var1).getSource();
  42.       if (var3 instanceof JTextComponent && var2 instanceof Document) {
  43.          this.updateInputAttributes(0, 0, (JTextComponent)var3);
  44.       }
  45.  
  46.    }
  47.  
  48.    public void caretUpdate(CaretEvent var1) {
  49.       this.updateInputAttributes(var1.getDot(), var1.getMark(), (JTextComponent)((EventObject)var1).getSource());
  50.    }
  51. }
  52.