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$ForegroundAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.3 KB  |  42 lines

  1. package javax.swing.text;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Toolkit;
  5. import java.awt.event.ActionEvent;
  6. import java.util.EventObject;
  7. import javax.swing.JEditorPane;
  8.  
  9. public class StyledEditorKit$ForegroundAction extends StyledEditorKit.StyledTextAction {
  10.    // $FF: renamed from: fg java.awt.Color
  11.    private Color field_0;
  12.  
  13.    public StyledEditorKit$ForegroundAction(String var1, Color var2) {
  14.       super(var1);
  15.       this.field_0 = var2;
  16.    }
  17.  
  18.    public void actionPerformed(ActionEvent var1) {
  19.       JEditorPane var2 = ((StyledEditorKit.StyledTextAction)this).getEditor(var1);
  20.       if (var2 != null) {
  21.          Color var3 = this.field_0;
  22.          if (var1 != null && ((EventObject)var1).getSource() == var2) {
  23.             String var4 = var1.getActionCommand();
  24.  
  25.             try {
  26.                var3 = Color.decode(var4);
  27.             } catch (NumberFormatException var6) {
  28.             }
  29.          }
  30.  
  31.          if (var3 != null) {
  32.             SimpleAttributeSet var7 = new SimpleAttributeSet();
  33.             StyleConstants.setForeground(var7, var3);
  34.             ((StyledEditorKit.StyledTextAction)this).setCharacterAttributes(var2, var7, false);
  35.          } else {
  36.             Toolkit.getDefaultToolkit().beep();
  37.          }
  38.       }
  39.  
  40.    }
  41. }
  42.