home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 144 / DPCS0200.iso / Internet / Supanet / system / swing.jar / javax / swing / text / StyledEditorKit$FontFamilyAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-11-05  |  1.5 KB  |  39 lines

  1. package javax.swing.text;
  2.  
  3. import java.awt.Toolkit;
  4. import java.awt.event.ActionEvent;
  5. import java.util.EventObject;
  6. import javax.swing.JEditorPane;
  7.  
  8. public class StyledEditorKit$FontFamilyAction extends StyledEditorKit.StyledTextAction {
  9.    private String family;
  10.  
  11.    public StyledEditorKit$FontFamilyAction(String var1, String var2) {
  12.       super(var1);
  13.       this.family = var2;
  14.    }
  15.  
  16.    public void actionPerformed(ActionEvent var1) {
  17.       JEditorPane var2 = ((StyledEditorKit.StyledTextAction)this).getEditor(var1);
  18.       if (var2 != null) {
  19.          String var3 = this.family;
  20.          if (var1 != null && ((EventObject)var1).getSource() == var2) {
  21.             String var4 = var1.getActionCommand();
  22.             if (var4 != null) {
  23.                var3 = var4;
  24.                System.out.println("s: " + var4);
  25.             }
  26.          }
  27.  
  28.          if (var3 != null) {
  29.             SimpleAttributeSet var5 = new SimpleAttributeSet();
  30.             StyleConstants.setFontFamily(var5, var3);
  31.             ((StyledEditorKit.StyledTextAction)this).setCharacterAttributes(var2, var5, false);
  32.          } else {
  33.             Toolkit.getDefaultToolkit().beep();
  34.          }
  35.       }
  36.  
  37.    }
  38. }
  39.