home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161a.iso / handson / files / copyjava.exe / com / sun / java / swing / text / html / HTMLEditorKit$HTMLItalicAction.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-26  |  1.8 KB  |  35 lines

  1. package com.sun.java.swing.text.html;
  2.  
  3. import com.sun.java.swing.JEditorPane;
  4. import com.sun.java.swing.JToggleButton;
  5. import com.sun.java.swing.text.JTextComponent;
  6. import com.sun.java.swing.text.SimpleAttributeSet;
  7. import com.sun.java.swing.text.StyleConstants;
  8. import com.sun.java.swing.text.StyledEditorKit;
  9. import com.sun.java.swing.text.TextAction;
  10. import java.awt.event.ActionEvent;
  11. import java.util.EventObject;
  12.  
  13. class HTMLEditorKit$HTMLItalicAction extends HTMLEditorKit.HtmlAction {
  14.    public HTMLEditorKit$HTMLItalicAction() {
  15.       super("html-italic-action");
  16.    }
  17.  
  18.    public void actionPerformed(ActionEvent var1) {
  19.       JTextComponent var2 = ((TextAction)this).getFocusedComponent();
  20.       if (var2 != null) {
  21.          JEditorPane var3 = (JEditorPane)var2;
  22.          SimpleAttributeSet var4 = new SimpleAttributeSet();
  23.          Object var5 = ((EventObject)var1).getSource();
  24.          boolean var6 = true;
  25.          if (var5 != null && var5 instanceof JToggleButton) {
  26.             var6 = ((JToggleButton)var5).isSelected();
  27.          }
  28.  
  29.          StyleConstants.setItalic(var4, var6);
  30.          ((StyledEditorKit.StyledTextAction)this).setCharacterAttributes(var3, var4, false);
  31.       }
  32.  
  33.    }
  34. }
  35.