5959import java .util .Scanner ;
6060import javax .swing .text .DefaultEditorKit ;
6161import javax .swing .text .StyledEditorKit ;
62+ import javax .swing .text .AttributeSet .FontAttribute ;
63+
6264import java .awt .event .*;
6365
6466public class UI extends JFrame implements ActionListener {
@@ -568,6 +570,7 @@ else if (e.getSource() == boldButton) {
568570 } else {
569571 textArea .setFont (textArea .getFont ().deriveFont (Font .BOLD ));
570572 }
573+
571574 }// If the source of the event was the "Italic" button
572575 else if (e .getSource () == italicButton ) {
573576 if (textArea .getFont ().getStyle () == Font .ITALIC ) {
@@ -591,18 +594,19 @@ else if(e.getSource() == underlineButton){
591594 //fontAttributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
592595 //Font UNDERLINE = new Font("Centry Gothic", Font.PLAIN, 12).deriveFont(fontAttributes);
593596
594- //Amshah Mushtaq - strikethrough feature
597+ //Amshah Mushtaq - strikethrough feature
598+
595599 else if (e .getSource () == strikethroughButton ){
596- HashMap <TextAttribute , Integer > fontAttribute = new HashMap <TextAttribute , Integer >();
597- fontAttribute .put (TextAttribute .STRIKETHROUGH , TextAttribute .STRIKETHROUGH_ON );
598- Font STRIKETHROUGH = new Font ("Centry" , Font .PLAIN , 12 ).deriveFont (fontAttribute );
600+ HashMap <TextAttribute , Boolean > fontAttributes = new HashMap <TextAttribute , Boolean >();
601+ fontAttributes .put (TextAttribute .STRIKETHROUGH , TextAttribute .STRIKETHROUGH_ON );
602+ Font STRIKETHROUGH = new Font ("Centry Gothic " , Font .PLAIN , 12 ).deriveFont (fontAttributes );
599603 if (textArea .getFont ().getStyle () == STRIKETHROUGH .getStyle () ){
600- textArea .setFont (textArea .getFont ().deriveFont (Font . PLAIN ));
604+ textArea .setFont (textArea .getFont ().deriveFont (fontAttributes ));
601605 } else {
602606 textArea .setFont (textArea .getFont ().deriveFont (STRIKETHROUGH .getStyle ()));
603607 }
604- }///STILL WORKING HERE!!!
605-
608+ }
609+
606610
607611 // Clear File (Code)
608612 if (e .getSource () == clearFile || e .getSource () == clearButton ) {
0 commit comments